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): several small fixes to run cli-hello-world-ivy integration test suite #27438

Closed
wants to merge 6 commits into from

Conversation

JoostK
Copy link
Member

@JoostK JoostK commented Dec 3, 2018

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:

What is the current behavior?

The cli-hello-world-ivy test would only build, not actually run. With some Ivy fixes the tests can now actually be enabled:

Fixes:

  • Pipes would not be available to JIT compiled modules.
  • Several __POST_R3__ symbols were DCE'd. The integration test now finally catches those.
  • The setClassMetadata would fail to be generated from ngcc for ES5 bundles.

This builds on top of #27159 as the ESM5 bundle is used for tests.

What is the new behavior?

Ivy Hello World integration test actually runs 🎉

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@@ -51,6 +51,10 @@ export function compileNgModuleDefs(moduleType: Type<any>, ngModule: NgModule):
exports: flatten(ngModule.exports || EMPTY_ARRAY).map(expandModuleWithProviders),
emitInline: true,
});

if (applyScope) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit of a hack, but TestBed applies its own module scopes which this would otherwise interfere with. I have some work in #27399 to hopefully avoid this in the future, but that needs some more work.

@@ -198,7 +202,7 @@ export function transitiveScopesFor<T>(moduleType: Type<T>): NgModuleTransitiveS
scopes.compilation.pipes.add(entry);
scopes.exported.pipes.add(entry);
});
} else if (getNgModuleDef(exportedTyped)) {
} else if (getPipeDef(exportedTyped)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This bug was not found with TestBed tests as it has its own idea of module scopes, so this code was not relevant there. With the work in #27399 I deleted the custom module scope application (for now, we might still need something similar as my current approach seems too limited) and that uncovered this issue.

@JoostK
Copy link
Member Author

JoostK commented Dec 3, 2018

I'll have to investigate why Travis fails with Error: Importing BrowserDynamicTestingModule which does not have an @ngModule. Somehow the setClassMetaData call is not present in the FESM5 bundles. I have seen this working locally but now also have the same error, not sure what has changed 🤷‍♂️

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

I have no idea about the setScopeOnDeclaredComponents() change.
The rest looks great 😃

@pkozlowski-opensource
Copy link
Member

@JoostK @gkalpak I think that TestBed is definitively doing sth fishy with scopes, I remember discussing it briefly with @alxhub in the past.

@JoostK
Copy link
Member Author

JoostK commented Dec 4, 2018

@JoostK @gkalpak I think that TestBed is definitively doing sth fishy with scopes, I remember discussing it briefly with @alxhub in the past.

Yes, it definitely is. Basically TestBed has its own module scoping as it walks the module graph to recompile everything anyway based on the registered overrides. That's what #27399 is supposed to avoid, although the module scope modifications prove to be problematic.

@JoostK JoostK force-pushed the ivy-green-integration-test branch 3 times, most recently from 6da5be0 to fcf4948 Compare December 4, 2018 22:01
@JoostK
Copy link
Member Author

JoostK commented Dec 4, 2018

@gkalpak All green now 🍏 💚 I've had to disable the ci-production e2e configuration as that would timeout with an error that Angular cannot be found. Don't know what's going on exactly but I'm accepting for now that that test just doesn't run yet.

if (checkMarkerFile(entryPoint, format)) {
console.warn(`Skipping ${entryPoint.name} : ${format} (already built).`);
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

👌

"start": "ng serve",
"test": "ng build --progress false"
"test": "ng test --progress=false --watch=false && yarn e2e --configuration=ci"
Copy link
Member

Choose a reason for hiding this comment

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

Can you leave a TODO comment here mentioning that ci-production is failing? E.g.:

"//test1": "TODO: Re-enable `ci-production`. Currently, it fails like this and that.", 
"//test2": "ng test --progress=false --watch=false && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production",

Copy link
Member Author

Choose a reason for hiding this comment

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

@gkalpak Good idea, done!

Copy link
Member

Choose a reason for hiding this comment

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

Thx! Can you also add that this is tracked in Jira issue is FW-813?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gkalpak Done, thanks for registering in Jira 👍

@JoostK JoostK force-pushed the ivy-green-integration-test branch 2 times, most recently from ae877e4 to b48bcf8 Compare December 6, 2018 22:25
"start": "ng serve",
"test": "ng build --progress false"
"test": "ng test --progress=false --watch=false && yarn e2e --configuration=ci"
Copy link
Member

Choose a reason for hiding this comment

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

Thx! Can you also add that this is tracked in Jira issue is FW-813?

@JoostK JoostK force-pushed the ivy-green-integration-test branch 4 times, most recently from 316d64e to 3902d92 Compare December 10, 2018 18:45
@gkalpak gkalpak 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 12, 2018
@ngbot ngbot bot added this to the needsTriage milestone Dec 12, 2018
@gkalpak
Copy link
Member

gkalpak commented Dec 12, 2018

Marking this as blocked on #27159. (I'd prefer to merge that first in order to preserve the PR comment history.)

@alxhub
Copy link
Member

alxhub commented Dec 13, 2018

Nice work!

Copy link
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

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

Waiting to rebase once #27159 lands

While creating FESM files, rollup usually drops all unused symbols.
All *__POST_R3__ are unused unless ngcc rewires stuff. To prevent this DCE
we reexport them as private symbols. If ngcc is not used, these symbols will
be dropped when we optimize an application bundle.
This is tested in the Ivy CLI integration test.
ngcc would feed ngtsc with the function declaration inside of an IIFE as
that is considered the class symbol's declaration node, according to
TypeScript's `ts.Symbol.valueDeclaration`. ngtsc however only considered
variable decls and actual class decls as potential class declarations,
so given the function declaration node it would fail to generate the
`setClassMetadata` call.

ngtsc no longer makes its own assumptions about what classes look like,
but always asks the reflection host to yield this kind of information.
With the bundle info being assembled into a single object before the
transform is started, we now greedily create a TypeScript program up-front.
If a marker file exists that indicates that the bundle could be skipped
the program creation has already taken place which takes a significant
amount of time. This commit moves the marker check to occur before the
bundle is assembled.
…ration suite

The ci-production e2e test is diabled because Angular fails to be found
@JoostK JoostK force-pushed the ivy-green-integration-test branch 2 times, most recently from ade4563 to a455354 Compare December 15, 2018 18:28
@JoostK
Copy link
Member Author

JoostK commented Dec 15, 2018

Rebased now that #27159 has been merged. Tests are green, presubmit time!

@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 16, 2018
@gkalpak
Copy link
Member

gkalpak commented Dec 16, 2018

Note to caretaker: Assistance needed with g3sync.

@mhevery mhevery closed this in 1160025 Dec 17, 2018
mhevery pushed a commit that referenced this pull request Dec 17, 2018
This is tested in the Ivy CLI integration test.

PR Close #27438
mhevery pushed a commit that referenced this pull request Dec 17, 2018
ngcc would feed ngtsc with the function declaration inside of an IIFE as
that is considered the class symbol's declaration node, according to
TypeScript's `ts.Symbol.valueDeclaration`. ngtsc however only considered
variable decls and actual class decls as potential class declarations,
so given the function declaration node it would fail to generate the
`setClassMetadata` call.

ngtsc no longer makes its own assumptions about what classes look like,
but always asks the reflection host to yield this kind of information.

PR Close #27438
mhevery pushed a commit that referenced this pull request Dec 17, 2018
…27438)

With the bundle info being assembled into a single object before the
transform is started, we now greedily create a TypeScript program up-front.
If a marker file exists that indicates that the bundle could be skipped
the program creation has already taken place which takes a significant
amount of time. This commit moves the marker check to occur before the
bundle is assembled.

PR Close #27438
mhevery pushed a commit that referenced this pull request Dec 17, 2018
…ration suite (#27438)

The ci-production e2e test is diabled because Angular fails to be found

PR Close #27438
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
While creating FESM files, rollup usually drops all unused symbols.
All *__POST_R3__ are unused unless ngcc rewires stuff. To prevent this DCE
we reexport them as private symbols. If ngcc is not used, these symbols will
be dropped when we optimize an application bundle.

PR Close angular#27438
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
This is tested in the Ivy CLI integration test.

PR Close angular#27438
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
…lar#27438)

ngcc would feed ngtsc with the function declaration inside of an IIFE as
that is considered the class symbol's declaration node, according to
TypeScript's `ts.Symbol.valueDeclaration`. ngtsc however only considered
variable decls and actual class decls as potential class declarations,
so given the function declaration node it would fail to generate the
`setClassMetadata` call.

ngtsc no longer makes its own assumptions about what classes look like,
but always asks the reflection host to yield this kind of information.

PR Close angular#27438
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
…ngular#27438)

With the bundle info being assembled into a single object before the
transform is started, we now greedily create a TypeScript program up-front.
If a marker file exists that indicates that the bundle could be skipped
the program creation has already taken place which takes a significant
amount of time. This commit moves the marker check to occur before the
bundle is assembled.

PR Close angular#27438
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
…ration suite (angular#27438)

The ci-production e2e test is diabled because Angular fails to be found

PR Close angular#27438
@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 merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note 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

5 participants