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): ngtsc is unable to detect flat module entry-point on windows #29453

Closed

Conversation

devversion
Copy link
Member

  • See individual commits

@devversion devversion added 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 Mar 21, 2019
@devversion devversion requested a review from a team as a code owner March 21, 2019 22:52
@ngbot ngbot bot modified the milestone: needsTriage Mar 21, 2019
Currently when building an Angular project with `ngtsc`
and `flatModuleOutFile` enabled, the Ngtsc build will fail
if there are multiple source files as root file names.

Ngtsc and NGC currently determine the entry-point for multiple
root file names by looking for files ending with `/index.ts`.

This functionality is technically deprecated, but still supported
and currently breaks on Windows as the root file names are not
guaranteed to be normalized POSIX-like paths.

In order to make this logic more reliable in the future, this commit
also switches the shim generators and entry-point logic to the branded
path types. This ensures that we don't break this in the future.
@devversion devversion 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 Mar 27, 2019
@ngbot
Copy link

ngbot bot commented Mar 27, 2019

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/circleci: test_docs_examples" is failing
    pending status "google3" is pending
    pending missing required status "ci/circleci: publish_snapshot"

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@devversion
Copy link
Member Author

devversion commented Mar 27, 2019

Caretaker note: Please merge assistance because test_docs_examples fails due to a flake.

@mhevery mhevery closed this in e57ed61 Mar 27, 2019
mhevery pushed a commit that referenced this pull request Mar 27, 2019
#29453)

Currently when building an Angular project with `ngtsc`
and `flatModuleOutFile` enabled, the Ngtsc build will fail
if there are multiple source files as root file names.

Ngtsc and NGC currently determine the entry-point for multiple
root file names by looking for files ending with `/index.ts`.

This functionality is technically deprecated, but still supported
and currently breaks on Windows as the root file names are not
guaranteed to be normalized POSIX-like paths.

In order to make this logic more reliable in the future, this commit
also switches the shim generators and entry-point logic to the branded
path types. This ensures that we don't break this in the future.

PR Close #29453
wKoza pushed a commit to wKoza/angular that referenced this pull request Apr 17, 2019
angular#29453)

Currently when building an Angular project with `ngtsc`
and `flatModuleOutFile` enabled, the Ngtsc build will fail
if there are multiple source files as root file names.

Ngtsc and NGC currently determine the entry-point for multiple
root file names by looking for files ending with `/index.ts`.

This functionality is technically deprecated, but still supported
and currently breaks on Windows as the root file names are not
guaranteed to be normalized POSIX-like paths.

In order to make this logic more reliable in the future, this commit
also switches the shim generators and entry-point logic to the branded
path types. This ensures that we don't break this in the future.

PR Close angular#29453
@@ -60,14 +61,16 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost {
shouldCreateNewSourceFile?: boolean|undefined): ts.SourceFile|undefined {
for (let i = 0; i < this.shimGenerators.length; i++) {
const generator = this.shimGenerators[i];
if (generator.recognize(fileName)) {
// TypeScript internal paths are guaranteed to be POSIX-like absolute file paths.
const absoluteFsPath = AbsoluteFsPath.fromUnchecked(fileName);
Copy link
Member

Choose a reason for hiding this comment

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

It turns out (at least in tests) that it is not true that fileName is always absolute. Changing this to AbsoluteFsPath.from() causes lots of test failures such as:

193) compiler compliance: listen() should create declare inputs/outputs
  Message:
    Error: Internal Error: AbsoluteFsPath.from(lib.d.ts): path is not absolute
  Stack:
    Error: Internal Error: AbsoluteFsPath.from(lib.d.ts): path is not absolute
        at Object.from (packages/compiler-cli/src/ngtsc/path/src/types.ts:59:13)
        at GeneratedShimsHostWrapper.getSourceFile (packages/compiler-cli/src/ngtsc/shims/src/host.ts:76:45)

@devversion & @alxhub

@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 15, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants