question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NGCC create-ivy-entry-points for all project libraries before parallel test

See original GitHub issue

We based our new build pipeline on standard ng cli commands. Especially for parallel builds, we create a dependency tree reading library’s package.json file and run ng build command on our libraries in a parallel way.

For this particular task, the ngcc call before all compilation steps works like a charm (see https://angular.io/guide/ivy#speeding-up-ngcc-compilation).

The main problem now is that we would like to run tests also on parallel way after we build our libraries. Actually, ng test libraryName command, just tries to compile in ‘ivy’ way all our libraries it depends on, every time we execute tests.

Running our CI pipeline with a sequential test approach doesn’t raise errors (but it is slower). Feature requested is just related to a way to compile our project libraries on dist folder in ‘ivy’ way before run tests to support also parallel tests.

See for example error from our teamcity agent:

Start to test projects parallel with 4 cpus
08:13:46
    Start test of @aulos/core with dependencies: []
08:13:46
    Start test of @aulos/common with dependencies: []
08:13:46
    Start test of @aulos/common-validators with dependencies: []
08:13:55
    JavaScript Unit Tests
08:13:55
      18 03 2020 08:13:55.510:INFO [karma-server]: Karma v4.2.0 server started at http://0.0.0.0:9877/
08:13:55
      18 03 2020 08:13:55.526:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
08:13:55
      18 03 2020 08:13:55.545:INFO [launcher]: Starting browser ChromeHeadless
08:13:55
      JavaScript Unit Tests
08:13:56
      ERROR in ngcc is already running at process with id 4565.
08:13:56
      If you are running multiple builds in parallel then you should pre-process your node_modules via the command line ngcc tool before starting the builds;
08:13:56
      See https://v9.angular.io/guide/ivy#speeding-up-ngcc-compilation
08:13:56
      (If you are sure no ngcc process is running then you should delete the lockfile at /opt/teamcity-agent/work/d27e3f1950cca49c/node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__.)
08:13:56
      End test process of @aulos/core with code 1
08:13:56
      We have to test 3 libraries with 2 free cpu.
08:13:56
      Start test of @aulos/security with dependencies: [@aulos/core]
08:13:56
      Start test of @aulos/globalization with dependencies: [@aulos/core]
08:13:56
      Start test of @aulos/binary-resources with dependencies: [@aulos/core]
08:13:59
      
08:13:59
      Compiling @aulos/common : es2015 as esm2015
08:14:01
      18 03 2020 08:14:01.074:INFO [karma-server]: Karma v4.2.0 server started at http://0.0.0.0:9878/
08:14:01
      18 03 2020 08:14:01.075:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
08:14:01
      18 03 2020 08:14:01.084:INFO [launcher]: Starting browser ChromeHeadless

As you can see we run 3 concurrency tests but they require building our libraries (for example @aulos/common).

So request here is to enable ngcc ..... --create-ivy-entry-points also on ./dist/libraries folders.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:26 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Mar 20, 2020

I have a fix in the works. See #36180

1reaction
petebacondarwincommented, Mar 20, 2020

The improvements to CLI+ngcc integration were to run ngcc in async mode across the node_modules before running the build, where ngcc can only be run in sync mode. The benefits of async mode are: slight performance improvement if tasks can be run in parallel; and ability for ngcc to pause and wait (rather crashing) if another build is running ngcc.

This new integration is not able to build packages that are not in node_modules (e.g. in dist) as in this scenario since at that point it does not have access to the path mappings etc. So in your case you still need to run ngcc against the dist folder before running ng build if you want to run the builds in parallel. (If the builds are not parallel then there is no problem because the sync CLI+ngcc integration can handle dist packages.

If we implement ngcc looking up a local tsconfig.json when in async parallel mode then it might be that the new async CLI+ngcc integration might be able to handle this scenario too!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nx build - Another process, with id xxx, is currently running ngcc
Ideally we should be able to run ngcc once before building any project, and then use the result for the parallel, that way...
Read more >
Speeding up Angular 10 parallel production build - Ljiljana Matic
In all of our projects we have included common angular library shared across. ... via the command line ngcc tool before starting the...
Read more >
Getting Started with Monorepo with Nx Nrwl - Rupesh Tiwari
I want to create logger angular library under lib/branding folder with karma testing framework. This is my dry run result. Logger project is ......
Read more >
On my CI i m currently u… - @Nrwl/Community
Please build these libraries before: logging Try: nx run-many –target build ... "postinstall": "ngcc --properties es2015 browser module main ...
Read more >
Craft a complete GitLab pipeline for Angular. Part 1
Learn Gitlab to build a CI/CD pipeline for Angular apps and libraries. ... Before building and testing your app it's necessary to install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found