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.

Incremental `yarn bazel build //src:prodapp` time is not consistent.

See original GitHub issue

🐞 bug report

Incremental yarn bazel build //src:prodapp time is not consistent in a new Angular Bazel project.

Is this a regression?

I don’t know

🔬 Minimal Reproduction

  1. Create a new Angular Bazel app
yarn ng new bzl-app --collection=@angular/bazel
  1. Build the project
yarn bazel build //src:prodapp # Or just yarn ng build
  1. Repeating the following command
echo "" >> src/main.dev.ts && yarn bazel build //src:prodapp

If enough times, you’ll see two different build time:

pcloudy@pcloudy:~/workspace/angular_playground/bzl-app
$ echo "" >> src/main.dev.ts && yarn bazel build //src:prodapp
yarn run v1.12.3
warning ../package.json: No license field
$ /usr/local/google/home/pcloudy/workspace/angular_playground/bzl-app/node_modules/.bin/bazel build //src:prodapp
INFO: Analysed target //src:prodapp (1 packages loaded, 1 target configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  dist/bin/src/prodapp
INFO: Elapsed time: 15.826s, Critical Path: 15.01s
INFO: 5 processes: 3 linux-sandbox, 1 local, 1 worker.
INFO: Build completed successfully, 7 total actions
Done in 15.96s.

and

pcloudy@pcloudy:~/workspace/angular_playground/bzl-app
$ echo "" >> src/main.dev.ts && yarn bazel build //src:prodapp
yarn run v1.12.3
warning ../package.json: No license field
$ /usr/local/google/home/pcloudy/workspace/angular_playground/bzl-app/node_modules/.bin/bazel build //src:prodapp
INFO: Analysed target //src:prodapp (1 packages loaded, 1 target configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  dist/bin/src/prodapp
INFO: Elapsed time: 5.266s, Critical Path: 4.72s
INFO: 2 processes: 1 linux-sandbox, 1 worker.
INFO: Build completed successfully, 4 total actions
Done in 5.39s.

🌍 Your Environment

Angular Version:


pcloudy@pcloudy:~/workspace/angular_playground/bzl-app
$ yarn ng version
yarn run v1.12.3
warning ../package.json: No license field
$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.0.0-rc.2
Node: 10.15.3
OS: linux x64
Angular: 8.0.0-rc.2
... animations, bazel, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0-rc.2
@angular-devkit/build-angular     0.800.0-rc.2
@angular-devkit/build-optimizer   0.800.0-rc.2
@angular-devkit/build-webpack     0.800.0-rc.2
@angular-devkit/core              8.0.0-rc.2
@angular-devkit/schematics        8.0.0-rc.2
@ngtools/webpack                  8.0.0-rc.2
@schematics/angular               8.0.0-rc.2
@schematics/update                0.800.0-rc.2
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0
    
Done in 0.57s.

Anything else relevant? This is also reproducible on Windows

pcloudy@pcloudy0-w MSYS ~/workspace/angular_playground/bzl-app
$ echo "" >> src/main.dev.ts && yarn bazel build //src:prodapp --experimental_generate_json_trace_profile
yarn run v1.12.3
warning ..\package.json: No license field
$ C:\tools\msys64\home\pcloudy\workspace\angular_playground\bzl-app\node_modules\.bin\bazel build //src:prodapp --experimental_generate_json_trace_profile
INFO: Writing tracer profile to 'C:/src/tmp/7qwhmymr/command.profile'
INFO: Reading 'startup' options from c:\users\pcloudy\.bazelrc: --output_user_root=C:/src/tmp
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=320
INFO: Options provided by the client:
  'build' options: --python_path=C:/Python36/python.exe
INFO: Reading rc options for 'build' from c:\tools\msys64\home\pcloudy\workspace\angular_playground\bzl-app\.bazelrc:
  'build' options: --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker --symlink_prefix=dist/ --incompatible_strict_action_env --define=compile=legacy
INFO: Reading rc options for 'build' from c:\users\pcloudy\.bazelrc:
  'build' options: --curses=yes --color=yes --verbose_failures --announce_rc
INFO: Analysed target //src:prodapp (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  C:/src/tmp/7qwhmymr/execroot/project/bazel-out/x64_windows-fastbuild/bin/src/prodapp
INFO: Elapsed time: 22.983s, Critical Path: 21.78s
INFO: 5 processes: 4 local, 1 worker.
INFO: Build completed successfully, 7 total actions
Done in 23.29s.

pcloudy@pcloudy0-w MSYS ~/workspace/angular_playground/bzl-app
$ echo "" >> src/main.dev.ts && yarn bazel build //src:prodapp --experimental_generate_json_trace_profile
yarn run v1.12.3
warning ..\package.json: No license field
$ C:\tools\msys64\home\pcloudy\workspace\angular_playground\bzl-app\node_modules\.bin\bazel build //src:prodapp --experimental_generate_json_trace_profile
INFO: Writing tracer profile to 'C:/src/tmp/7qwhmymr/command.profile'
INFO: Reading 'startup' options from c:\users\pcloudy\.bazelrc: --output_user_root=C:/src/tmp
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=320
INFO: Options provided by the client:
  'build' options: --python_path=C:/Python36/python.exe
INFO: Reading rc options for 'build' from c:\tools\msys64\home\pcloudy\workspace\angular_playground\bzl-app\.bazelrc:
  'build' options: --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker --symlink_prefix=dist/ --incompatible_strict_action_env --define=compile=legacy
INFO: Reading rc options for 'build' from c:\users\pcloudy\.bazelrc:
  'build' options: --curses=yes --color=yes --verbose_failures --announce_rc
INFO: Analysed target //src:prodapp (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  C:/src/tmp/7qwhmymr/execroot/project/bazel-out/x64_windows-fastbuild/bin/src/prodapp
INFO: Elapsed time: 7.474s, Critical Path: 6.27s
INFO: 2 processes: 1 local, 1 worker.
INFO: Build completed successfully, 4 total actions
Done in 7.78s.

You can add --experimental_generate_json_trace_profile to profile the build and use chrome://tracing to load and visualize the profile data. Here’s my result: Fast: image

Slow: image

Profile data is available here: profile.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
filipesilvacommented, May 9, 2019

@alxhub @manughub the CLI repository is not the correct repository for issues related to @angular/bazel. That package is developed in https://github.com/angular/angular/tree/master/packages/bazel. The angular/angular repository, where it was opened, was the correct place to open it.

cc @kyliau

0reactions
angular-automatic-lock-bot[bot]commented, Nov 29, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@bazel/typescript | Yarn - Package Manager
This package provides Bazel wrappers around the TypeScript compiler. At a high level, there are four alternatives provided. This section describes the ...
Read more >
Building JavaScript Outputs - Bazel 5.1.0
Bazel supports an incremental and customizable means of building and testing JavaScript outputs from JavaScript and TypeScript sources.
Read more >
Project build files are deleted when running under yarn ...
On a project I'm working on we are using Yarn workspaces currently. We'd like to incrementally migrate some of the build to Bazel...
Read more >
Angular 8 - Bazel Walkthrough - Bits and Pieces - Bit.dev
Incremental build means that it will only build what has changed since the last build. Bazel does this by building a task graph...
Read more >
Dependencies | rules_nodejs - GitHub Pages
Bazel works alongside your existing package manager, either npm or yarn. ... of your build, it is recommended that you use Bazel-managed dependencies....
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