Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ivy): check semantics of NgModule for consistency #27604

Closed
wants to merge 5 commits into from

Conversation

mhevery
Copy link
Contributor

@mhevery mhevery commented Dec 11, 2018

NgModule requires that Components/Directives/Pipes are listed in
declarations, and that each Components/Directives/Pipe is declared
in exactly one NgModule. This change adds runtime checks to ensure
that these sementics are true at runtime.

There will need to be seperate set of checks for the AoT path of the
codebase to verify that same set of semantics hold. Due to current
design there does not seem to be an easy way to share the two checks
because JIT deal with references where as AoT deals with AST nodes.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

@mary-poppins
Copy link

You can preview 8197b6d at https://pr27604-8197b6d.ngbuilds.io/.

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits

packages/core/test/linker/ng_module_integration_spec.ts Outdated Show resolved Hide resolved
packages/core/src/linker/ng_module_factory_loader.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
}

export function clearModulesForTest() {
moduleFactories = new Map<string, NgModuleFactory<any>>();
export function registerNgModuleType(id: string, ngModuleType: NgModuleType) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could have been a separate feat commit, since this is new behavior :)

packages/core/test/linker/ng_module_integration_spec.ts Outdated Show resolved Hide resolved
@kara kara added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release comp: ivy labels Dec 11, 2018
@ngbot ngbot bot added this to the needsTriage milestone Dec 11, 2018
@kara kara removed their assignment Dec 11, 2018
packages/core/src/di/r3_injector.ts Outdated Show resolved Hide resolved
packages/core/src/di/r3_injector.ts Outdated Show resolved Hide resolved
packages/core/src/linker/ng_module_factory_loader.ts Outdated Show resolved Hide resolved
packages/core/src/render3/jit/module.ts Outdated Show resolved Hide resolved
packages/core/test/linker/ng_module_integration_spec.ts Outdated Show resolved Hide resolved
packages/core/testing/src/r3_test_bed.ts Outdated Show resolved Hide resolved
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

2 similar comments
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@mary-poppins
Copy link

You can preview c0b8828 at https://pr27604-c0b8828.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 09243f9 at https://pr27604-09243f9.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 5ccfe99 at https://pr27604-5ccfe99.ngbuilds.io/.

@mary-poppins
Copy link

You can preview e4614ce at https://pr27604-e4614ce.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 328d4e9 at https://pr27604-328d4e9.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 33668b4 at https://pr27604-33668b4.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 2ba9011 at https://pr27604-2ba9011.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 5aaea5e at https://pr27604-5aaea5e.ngbuilds.io/.

@mary-poppins
Copy link

You can preview b8bf96c at https://pr27604-b8bf96c.ngbuilds.io/.

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, aside from the CI failures

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@mary-poppins
Copy link

You can preview 679ff56 at https://pr27604-679ff56.ngbuilds.io/.

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 14, 2018
`NgModule` requires that `Component`s/`Directive`s/`Pipe`s are listed in
declarations, and that each `Component`s/`Directive`s/`Pipe` is declared
in exactly one `NgModule`. This change adds runtime checks to ensure
that these sementics are true at runtime.

There will need to be seperate set of checks for the AoT path of the
codebase to verify that same set of semantics hold. Due to current
design there does not seem to be an easy way to share the two checks
because JIT deal with references where as AoT deals with AST nodes.
@googlebot
Copy link

CLAs look good, thanks!

@mary-poppins
Copy link

You can preview 30e5f7f at https://pr27604-30e5f7f.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 5ce177a at https://pr27604-5ce177a.ngbuilds.io/.

@mhevery
Copy link
Contributor Author

mhevery commented Dec 17, 2018

@mary-poppins
Copy link

You can preview 66e2f6f at https://pr27604-66e2f6f.ngbuilds.io/.

@mhevery mhevery closed this in e94975d Dec 17, 2018
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
`NgModule` requires that `Component`s/`Directive`s/`Pipe`s are listed in
declarations, and that each `Component`s/`Directive`s/`Pipe` is declared
in exactly one `NgModule`. This change adds runtime checks to ensure
that these sementics are true at runtime.

There will need to be seperate set of checks for the AoT path of the
codebase to verify that same set of semantics hold. Due to current
design there does not seem to be an easy way to share the two checks
because JIT deal with references where as AoT deals with AST nodes.

PR Close angular#27604
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes effort2: days risk: low target: major This PR is targeted for the next major release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants