-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Allow specifying custom NGCC lockfile location (cannot build in parallel with Ivy) #35000
Comments
If you run ngcc yourself beforehand then the angular cli wont run it as part of it's build step. |
@Rush - thanks for posting this issue. From your description there are two scenarios:
As @Toxicable points out the correct approach, when you expect to be running parallel builds, is to pre-process your packages via the ngcc command line. E.g. We should update the error message that is presented when the lockfile is found to explain this approach better. |
The message now gives concrete advice to developers who experience the error due to running multiple simultaneous builds via webpack. Fixes angular#35000
The message now gives concrete advice to developers who experience the error due to running multiple simultaneous builds via webpack. Fixes angular#35000
The message now gives concrete advice to developers who experience the error due to running multiple simultaneous builds via webpack. Fixes angular#35000
Thank you for the advice. I think it makes sense for NGCC to block simultaneous access to node_modules. Unfortunately just having
What has helped though was adding I can't say I understand what |
@Rush, glad you got it working! What options you need to pass to ngcc depends on your build configs. The set of options that emulates the default CLI behavior is Running
I hope this sheds some light. Let us know if you are still having issues (ideally providing a minimal reproduction 🙏). |
Having the same issue upgrading from rc.8 to rc.10. ngcc preprocessing was already set in my rc.8 builds and parallel build worked well, but no build can be achieved with rc.10 {"scripts": {
"build:staging": "npm-run-all --parallel build:staging:*",
"postinstall": "ngcc --create-ivy-entry-points"
}} tried the following combinations
ngcc postinstall runs well
but on every build i have
as if despite preprocessing with ngcc the builds would still launch ngcc... |
Any chance you could create a reproduction (e.g. a repo we can checkout and run), @jmbarbier? |
@gkalpak i think i have one 😄 --> https://github.com/solidev/repro-angular-issue-35000 just clone, run But i have added a simple It shows "Locked" message when a lock guarded function is used; we can of course see this lock during "postinstall" ngcc step, but also during parallel builds. Something somewhere during build is requesting a lock, so with parallel builds this can lead to failure(s). |
@jmbarbier - great! thanks for the repro. I had a play with it and I see what the problem is now... |
I added some more logging to your project and I see that ngcc is being triggered for a number of paths. Most of the time we are exiting early from ngcc without locking, as expected. But the following paths have not been marked as processed by the original run:
and we are locking for those. |
Since these are not Angular packages we need to do one of two things: a) mark these as processed in the original run |
Working on a fix (b) |
To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes angular#35000
To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes angular#35000
To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes angular#35000
To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes angular#35000
To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes #35000 PR Close #35057
The message now gives concrete advice to developers who experience the error due to running multiple simultaneous builds via webpack. Fixes angular#35000 PR Close angular#35001
…lar#35057) To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes angular#35000 PR Close angular#35057
…lar#35057) To support parallel CLI builds we instruct developers to pre-process their node_modules via ngcc at the command line. Despite doing this ngcc was still trying to set a lock when it was being triggered by the CLI for packages that are not going to be processed, since they are not compiled by Angular for instance. This commit checks whether a target package needs to be compiled at all before attempting to set the lock. Fixes angular#35000 PR Close angular#35057
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🚀 feature request
Relevant Package
This feature request is for @angular/compiler-cliDescription
I am running multiple webpack build pipelines simultaneously in CI. It does work without Ivy, but with Ivy (Angular 9 rc 11) it fails with:
Describe the solution you'd like
This line should allow overwriting the lock file location:
angular/packages/compiler-cli/ngcc/src/execution/lock_file.ts
Line 20 in d15cf60
Perhaps like so:
I think this is safe cause all simultaneous compiles are happening in Webpack so they're not conflicting with each other. @petebacondarwin @AndrewKushnir
Not having this would cause my builds running 10x more slowly due to a lot of parallelism.
Describe alternatives you've considered
Disabling the lock file with a config option.
The text was updated successfully, but these errors were encountered: