Skip to content

fix(cdk/schematics): fix resolving modules in ng update #21161

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

Merged
merged 1 commit into from
Dec 1, 2020
Merged

fix(cdk/schematics): fix resolving modules in ng update #21161

merged 1 commit into from
Dec 1, 2020

Conversation

kyubisation
Copy link
Contributor

Closes #21160

@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 27, 2020
@kyubisation
Copy link
Contributor Author

kyubisation commented Nov 29, 2020

@crisbeto The material schematics tests run into a memory issue. I suspect this is due to the migration now correctly resolving all related files, but I cannot say for certain. Do you have an idea on how this could be fixed?

@crisbeto
Copy link
Member

Even if it is resolving more files than before, we'd have to try really hard to get it to run out of memory. Could it be hitting an infinite loop somewhere? Also does this happen if you run the tests locally?

@kyubisation
Copy link
Contributor Author

Yes, I'm trying to investigate it right now. I need to setup the bazel debugging...

@kyubisation
Copy link
Contributor Author

I have currently narrowed it down to the material-imports.spec.ts and the hammer-migration-v9.spec.ts. I'm currently debugging it, to see what is happening.

@kyubisation
Copy link
Contributor Author

kyubisation commented Nov 29, 2020

Ok, the problem seems to be, that getDir in the HostTree treats a non-existent file path as a potential directory. This means getDir cannot be used to assert a path being a directory (and it also does not expose the isDirectory of its nested host).
I'll see if there is an alternative solution.

@kyubisation
Copy link
Contributor Author

@crisbeto I have refactored the directory check to query, if the parent directory has the given directory as a subdir. Please have another look.

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

Thank you for reworking it, it's looking much better! One more comment and it should be good to go.

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM and thank you for taking the time to get rid of our old workaround.

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker merge safe P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Nov 30, 2020
@kyubisation
Copy link
Contributor Author

No problem, thank you for the quick response. 😃
Do you think a release with this fix is possible this week or is that unlikely?
Depending on this we will wait for the release or try to provide a workaround internally in our company.

@crisbeto
Copy link
Member

Since this is only schematics code, it can be merged in quicker, but I can't guarantee when it'll be released.

@kyubisation
Copy link
Contributor Author

Ok, that's not a problem.
The workaround is to simply run ng update package --migrateOnly --from=10 --to=11, so we can live with that.

@kyubisation
Copy link
Contributor Author

@crisbeto I tested this with a few real life projects from our company and discovered an additional problem. When projects import package.json, typescript checks potential entry points (e.g /package.json/package.json and /package.json/index.ts) which would result in a failure with getDir. To avoid this I added a check to verify that the parent "directory" is not an existing file.

@mmalerba mmalerba merged commit b8b3923 into angular:master Dec 1, 2020
mmalerba pushed a commit that referenced this pull request Dec 1, 2020
@kyubisation kyubisation deleted the patch-1 branch December 1, 2020 22:36
@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 Jan 1, 2021
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 PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(cdk): DevkitFileSystem mistakenly assumes not a directory
3 participants