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(compiler-cli): ensure LogicalFileSystem maintains case in paths #37008

Conversation

petebacondarwin
Copy link
Member

The work to support case-sensitivity in the FileSystem went too far
with the LogicalFileSystem, which is used to compute import paths
that will be added to files processed by ngtsc and ngcc.

Previously all logical paths were canonicalised, which meant that on
case-insensitive file-systems, the paths were all set to lower case.
This resulted in incorrect imports being added to files. For example:

import { Apollo } from './Apollo';
import { SelectPipe } from './SelectPipe';
import * as ɵngcc0 from '@angular/core';
import * as ɵngcc1 from './selectpipe';

The import from ./SelectPipe is from the original file, while the
import from ./selectpipe is added by ngcc. This causes the
TypeScript compiler to complain, or worse for paths not to be
matched correctly.

Now, when computing logical paths, the original absolute paths
are matched against rootDirs in a canonical manner, but the actual
logical path that is returned maintains it original casing.

Fixes #36992, #36993, #37000

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?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@petebacondarwin petebacondarwin force-pushed the ngcc-issue-36992-lower-case-imports branch from e1e1512 to ed12b52 Compare May 8, 2020 14:45
@IgorMinar IgorMinar requested a review from JoostK May 8, 2020 15:17
@petebacondarwin petebacondarwin added area: compiler Issues related to `ngc`, Angular's template compiler action: review The PR is still awaiting reviews from at least one requested reviewer regression Indicates than the issue relates to something that worked in a previous version type: bug/fix labels May 8, 2020
@ngbot ngbot bot modified the milestone: needsTriage May 8, 2020
@petebacondarwin petebacondarwin marked this pull request as ready for review May 8, 2020 15:37
@petebacondarwin petebacondarwin added the target: major This PR is targeted for the next major release label May 8, 2020
@petebacondarwin petebacondarwin force-pushed the ngcc-issue-36992-lower-case-imports branch 2 times, most recently from e8a8656 to 6439b18 Compare May 8, 2020 16:30
@petebacondarwin
Copy link
Member Author

@petebacondarwin petebacondarwin added action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 13, 2020
@alxhub
Copy link
Member

alxhub commented May 13, 2020

Presubmit

@petebacondarwin petebacondarwin added action: presubmit The PR is in need of a google3 presubmit and removed action: presubmit The PR is in need of a google3 presubmit labels May 14, 2020
@petebacondarwin
Copy link
Member Author

@alxhub can you identify what failed in the presubmit?

@petebacondarwin petebacondarwin force-pushed the ngcc-issue-36992-lower-case-imports branch from 6439b18 to fc4253a Compare May 14, 2020 08:06
The work to support case-sensitivity in the `FileSystem` went too far
with the `LogicalFileSystem`, which is used to compute import paths
that will be added to files processed by ngtsc and ngcc.

Previously all logical paths were canonicalised, which meant that on
case-insensitive file-systems, the paths were all set to lower case.
This resulted in incorrect imports being added to files. For example:

```
import { Apollo } from './Apollo';
import { SelectPipe } from './SelectPipe';
import * as ɵngcc0 from '@angular/core';
import * as ɵngcc1 from './selectpipe';
```

The import from `./SelectPipe` is from the original file, while the
import from `./selectpipe` is added by ngcc. This causes the
TypeScript compiler to complain, or worse for paths not to be
matched correctly.

Now, when computing logical paths, the original absolute paths
are matched against rootDirs in a canonical manner, but the actual
logical path that is returned maintains it original casing.

Fixes angular#36992, angular#36993, angular#37000
@petebacondarwin petebacondarwin force-pushed the ngcc-issue-36992-lower-case-imports branch from fc4253a to 3a49f9c Compare May 15, 2020 09:46
@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels May 16, 2020
@kara kara closed this in 3dfc770 May 18, 2020
@petebacondarwin petebacondarwin deleted the ngcc-issue-36992-lower-case-imports branch May 18, 2020 17:33
@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 Jun 18, 2020
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
…ngular#37008)

The work to support case-sensitivity in the `FileSystem` went too far
with the `LogicalFileSystem`, which is used to compute import paths
that will be added to files processed by ngtsc and ngcc.

Previously all logical paths were canonicalised, which meant that on
case-insensitive file-systems, the paths were all set to lower case.
This resulted in incorrect imports being added to files. For example:

```
import { Apollo } from './Apollo';
import { SelectPipe } from './SelectPipe';
import * as ɵngcc0 from '@angular/core';
import * as ɵngcc1 from './selectpipe';
```

The import from `./SelectPipe` is from the original file, while the
import from `./selectpipe` is added by ngcc. This causes the
TypeScript compiler to complain, or worse for paths not to be
matched correctly.

Now, when computing logical paths, the original absolute paths
are matched against rootDirs in a canonical manner, but the actual
logical path that is returned maintains it original casing.

Fixes angular#36992, angular#36993, angular#37000

PR Close angular#37008
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 area: compiler Issues related to `ngc`, Angular's template compiler cla: yes regression Indicates than the issue relates to something that worked in a previous version 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.

Ivy (9.1.5) causes build failure
4 participants