Skip to content

Commit 00d8011

Browse files
josephperrottAndrewKushnir
authored andcommitted
build: Use Ivy compiler for bazel builds by default (#43862)
Setting the angular_ivy_enabled environment variable to True will default Bazel builds to use the Ivy compiler rather than defaulting to ViewEngine. PR Close #43862
1 parent 9f40d2a commit 00d8011

File tree

16 files changed

+30
-51
lines changed

16 files changed

+30
-51
lines changed

.bazelrc

+2-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ query --deleted_packages=integration/bazel,integration/bazel/src,integration/baz
8484
################################
8585
# Temporary Settings for Ivy #
8686
################################
87-
# To determine if the compiler used should be Ivy instead of ViewEngine, one can use `--config=ivy`
88-
# on any bazel target. This is a temporary flag until codebase is permanently switched to Ivy.
89-
build --define=angular_ivy_enabled=False
87+
# Set the default compiler used for bazel builds to be Ivy.
88+
build --define=angular_ivy_enabled=True
9089

9190
build:view-engine --define=angular_ivy_enabled=False
9291
build:ivy --define=angular_ivy_enabled=True

.circleci/config.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ jobs:
358358
command: |
359359
yarn bazel run //tools/saucelabs:sauce_service_setup
360360
TESTS=$(./node_modules/.bin/bazelisk query --output label '(kind(karma_web_test, ...) intersect attr("tags", "saucelabs", ...)) except attr("tags", "ivy-only", ...) except attr("tags", "fixme-saucelabs-ve", ...)')
361-
yarn bazel test --config=saucelabs ${TESTS}
361+
yarn bazel test --config=saucelabs --config=view-engine ${TESTS}
362362
yarn bazel run //tools/saucelabs:sauce_service_stop
363363
no_output_timeout: 40m
364364
- notify_webhook_on_fail:
@@ -382,7 +382,7 @@ jobs:
382382
command: |
383383
yarn bazel run //tools/saucelabs:sauce_service_setup
384384
TESTS=$(./node_modules/.bin/bazelisk query --output label '(kind(karma_web_test, ...) intersect attr("tags", "saucelabs", ...)) except attr("tags", "no-ivy-aot", ...) except attr("tags", "fixme-saucelabs-ivy", ...)')
385-
yarn bazel test --config=saucelabs --config=ivy ${TESTS}
385+
yarn bazel test --config=saucelabs ${TESTS}
386386
yarn bazel run //tools/saucelabs:sauce_service_stop
387387
no_output_timeout: 40m
388388
- notify_webhook_on_fail:
@@ -776,11 +776,11 @@ jobs:
776776
- setup_win
777777
- run:
778778
name: Build all windows CI targets
779-
command: bazel build --build_tag_filters=-ivy-only //packages/compiler-cli/...
779+
command: bazel build --config=view-engine --build_tag_filters=-ivy-only //packages/compiler-cli/...
780780
no_output_timeout: 15m
781781
- run:
782782
name: Test all windows CI targets
783-
command: bazel test --test_tag_filters="-ivy-only,-browser:chromium-local" //packages/compiler-cli/...
783+
command: bazel test --config=view-engine --test_tag_filters="-ivy-only,-browser:chromium-local" //packages/compiler-cli/...
784784
no_output_timeout: 15m
785785

786786
test_ivy_aot_win:
@@ -789,11 +789,11 @@ jobs:
789789
- setup_win
790790
- run:
791791
name: Build all windows CI targets
792-
command: bazel build --config=ivy --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot //packages/compiler-cli/...
792+
command: bazel build --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot //packages/compiler-cli/...
793793
no_output_timeout: 15m
794794
- run:
795795
name: Test all windows CI targets
796-
command: bazel test --config=ivy --test_tag_filters="-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local" //packages/compiler-cli/... //packages/localize/...
796+
command: bazel test --test_tag_filters="-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local" //packages/compiler-cli/... //packages/localize/...
797797
no_output_timeout: 15m
798798
# Save dependencies to use on subsequent runs.
799799
- save_cache:

.vscode/recommended-launch.json

-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"program": "${workspaceFolder}/node_modules/.bin/bazelisk",
4040
"args": [
4141
"test",
42-
"--config=ivy",
4342
"packages/core/test/acceptance",
4443
"--config=debug"
4544
],
@@ -57,7 +56,6 @@
5756
"program": "${workspaceFolder}/node_modules/.bin/bazelisk",
5857
"args": [
5958
"test",
60-
"--config=ivy",
6159
"packages/core/test/render3",
6260
"--config=debug"
6361
],
@@ -75,7 +73,6 @@
7573
"program": "${workspaceFolder}/node_modules/.bin/bazelisk",
7674
"args": [
7775
"test",
78-
"--config=ivy",
7976
"packages/core/test",
8077
"--config=debug"
8178
],

.vscode/recommended-tasks.json

-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
1010
"args": [
1111
"test",
12-
"--config=ivy",
1312
"packages/core/test",
1413
"packages/core/test/acceptance",
1514
"packages/core/test/render3",
@@ -42,7 +41,6 @@
4241
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
4342
"args": [
4443
"test",
45-
"--config=ivy",
4644
"packages/core/test/acceptance",
4745
],
4846
"group": "test",
@@ -71,7 +69,6 @@
7169
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
7270
"args": [
7371
"test",
74-
"--config=ivy",
7572
"packages/core/test",
7673
],
7774
"group": "test",
@@ -100,7 +97,6 @@
10097
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
10198
"args": [
10299
"test",
103-
"--config=ivy",
104100
"packages/core/test/render3",
105101
],
106102
"group": "test",

docs/BAZEL.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,8 @@ See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc
6363

6464
- `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below)
6565
- `--test_arg=--node_options=--inspect=9228`: change the inspector port.
66-
- `--config=ivy` Enables ivy mode if present, otherwise ViewEngine is used. This switches which compiler is used (ngc or ngtsc)
67-
- `--config=view-engine` Enables ViewEngine mode if present, currently this the default mode. This switches which compiler is used (ngc or ngtsc)
66+
- `--config=view-engine` Enables ViewEngine mode if present, otherwise Ivy is used. This switches which compiler is used (ngc or ngtsc)
6867
- `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config of your rules in any given `BUILD.bazel`.
69-
- `no-ivy-aot`: Useful for excluding build and test targets that are not meant to be executed in Ivy AOT mode (`--config=ivy`).
70-
- `ivy-only`: Useful for excluding all Ivy build and tests targets with `--config=view-engine`.
71-
- `fixme-ivy-aot`: Useful for including/excluding build and test targets that are currently broken in Ivy AOT mode (`--config=ivy`).
7268

7369

7470
### Debugging a Node Test
@@ -276,7 +272,7 @@ Require stack:
276272

277273
`bazel run` only works in Bazel Windows with non-test targets. Ensure that you are using `bazel test` instead.
278274

279-
e.g: `yarn bazel test packages/core/test/bundling/forms:symbol_test --config=ivy`
275+
e.g: `yarn bazel test packages/core/test/bundling/forms:symbol_test`
280276

281277
#### mkdir missing
282278
If you see the following error::

docs/DEBUG_COMPONENTS_REPO_IVY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ node ./scripts/ci/update-framework-deps-to-dist-packages.js {COMPONENTS_REPO}/pa
2020
following command:
2121

2222
```bash
23-
yarn test --deleted_packages=//src/dev-app --config=ivy
23+
yarn test --deleted_packages=//src/dev-app
2424
```
2525

2626
### Running tests for individual entry-points

packages/core/src/render3/util/global_utils.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import {getComponent, getContext, getDirectiveMetadata, getDirectives, getHostEl
1919
*
2020
* To see this in action run the following command:
2121
*
22-
* bazel run --config=ivy
23-
* //packages/core/test/bundling/todo:devserver
22+
* bazel run //packages/core/test/bundling/todo:devserver
2423
*
2524
* Then load `localhost:5432` and start using the console tools.
2625
*/

packages/core/test/bundling/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This is asserted by keeping gold files of all symbols which are expected to be r
66
When doing renaming it is often necessary to update the gold files, to do so use these commands:
77

88
```
9-
yarn bazel run --config=ivy //packages/core/test/bundling/injection:symbol_test.accept
10-
yarn bazel run --config=ivy //packages/core/test/bundling/cyclic_import:symbol_test.accept
11-
yarn bazel run --config=ivy //packages/core/test/bundling/forms:symbol_test.accept
12-
yarn bazel run --config=ivy //packages/core/test/bundling/hello_world:symbol_test.accept
13-
yarn bazel run --config=ivy //packages/core/test/bundling/router:symbol_test.accept
14-
yarn bazel run --config=ivy //packages/core/test/bundling/todo:symbol_test.accept
9+
yarn bazel run //packages/core/test/bundling/injection:symbol_test.accept
10+
yarn bazel run //packages/core/test/bundling/cyclic_import:symbol_test.accept
11+
yarn bazel run //packages/core/test/bundling/forms:symbol_test.accept
12+
yarn bazel run //packages/core/test/bundling/hello_world:symbol_test.accept
13+
yarn bazel run //packages/core/test/bundling/router:symbol_test.accept
14+
yarn bazel run //packages/core/test/bundling/todo:symbol_test.accept
1515
```
1616

1717
## Running all symbol tests

packages/core/test/bundling/core_all/BUILD.bazel

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ ng_rollup_bundle(
2828
js_size_tracking_test(
2929
name = "size_test",
3030
src = "angular/packages/core/test/bundling/core_all/bundle.min.js",
31-
# Ensures that this target runs with "--config=ivy" (aka Ivy). This is necessary
32-
# because we don't run this test on CI currently, but if we run it manually, we need to
33-
# ensure that it runs with Ivy for proper size comparisons.
3431
angular_ivy_enabled = "True",
3532
data = [
3633
"bundle.golden_size_map_ivy.json",

packages/core/test/render3/perf/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### Build
22

33
```
4-
yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}_lib.min_debug.js --config=ivy
4+
yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}_lib.min_debug.js
55
```
66

77
### Run
@@ -72,15 +72,15 @@ The resulting output should look something like this:
7272
### Notes
7373

7474
To run the benchmark use `bazel run <benchmark_target>`, example:
75-
- `yarn bazel run --config=ivy //packages/core/test/render3/perf:noop_change_detection`
75+
- `yarn bazel run //packages/core/test/render3/perf:noop_change_detection`
7676

7777
To profile, append `_profile` to the target name and attach a debugger via chrome://inspect, example:
78-
- `yarn bazel run --config=ivy //packages/core/test/render3/perf:noop_change_detection_profile`
78+
- `yarn bazel run //packages/core/test/render3/perf:noop_change_detection_profile`
7979

8080
To interactively edit/rerun benchmarks use `ibazel` instead of `bazel`.
8181

8282
To debug
8383
- Follow the directions in `profile_in_browser.html`
8484
OR
85-
- `yarn bazel build --config=ivy //packages/core/test/render3/perf:noop_change_detection`
85+
- `yarn bazel build //packages/core/test/render3/perf:noop_change_detection`
8686
- `node --inspect-brk bazel-out/darwin-fastbuild/bin/packages/core/test/render3/perf/noop_change_detection.min_debug.js`

packages/core/test/render3/perf/profile_all.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const profileTests =
2929

3030
// build tests
3131
shell.exec(
32-
`yarn bazel build --config=ivy ` +
32+
`yarn bazel build ` +
3333
profileTests.map((name) => `//packages/core/test/render3/perf:${name}_lib.min_debug.js`)
3434
.join(' '));
3535

packages/core/test/render3/perf/profile_in_browser.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
<body>
1111
<ol>
12-
<li>Build the benchmark using <tt>yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.js
13-
--config=ivy</tt></li>
12+
<li>Build the benchmark using <tt>yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.js</tt></li>
1413
<li>Open this file using the <tt>file://</tt> protocol and add <tt>?benchmark=BENCHMARK</tt> to the URL.</li>
1514
<li>
1615
Note: You should likely run this in an incognito browser with the "no-turbo-inlining" flag.<br />

scripts/build/angular-in-memory-web-api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function buildAngularInMemoryWebApiPackage(destDir) {
3434
console.info(`${scriptPath}:`);
3535
console.info(' Building angular-in-memory-web-api npm package');
3636
console.info('##############################');
37-
exec(`${bazelCmd} build //packages/misc/angular-in-memory-web-api:npm_package --config=ivy`);
37+
exec(`${bazelCmd} build //packages/misc/angular-in-memory-web-api:npm_package`);
3838

3939
// Create the output directory.
4040
const absDestDir = resolve(baseDir, destDir);

scripts/build/package-builder.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ function buildTargetPackages(destDir, description, isRelease = false) {
9292

9393
// Use either `--config=snapshot` or `--config=release` so that builds are created with the
9494
// correct embedded version info.
95-
exec(`${bazelCmd} build --config=${isRelease ? 'release' : 'snapshot'} --config=ivy ${
96-
targets.join(' ')}`);
95+
exec(`${bazelCmd} build --config=${isRelease ? 'release' : 'snapshot'} ${targets.join(' ')}`);
9796

9897
// Create the output directory.
9998
const absDestDir = resolve(baseDir, destDir);

tools/saucelabs/README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ yarn bazel run //tools/saucelabs:sauce_service_setup
2929
For example, `packages/core/test:test_web` becomes `packages/core/test:saucelabs_test_web`.
3030

3131
```
32-
yarn bazel test //packages/core/test:saucelabs_test_web --config=saucelabs --config=ivy
32+
yarn bazel test //packages/core/test:saucelabs_test_web --config=saucelabs
3333
```
3434

35-
Remove the `--config=ivy` if you want to run through View Engine instead.
36-
3735
5. Sauce service log may be tailed or dumped with the following targets:
3836

3937
``` bash
@@ -54,15 +52,15 @@ Running all ViewEngine karma tests in Saucelabs:
5452
``` bash
5553
yarn bazel run //tools/saucelabs:sauce_service_setup
5654
TESTS=$(./node_modules/.bin/bazelisk query --output label '(kind(karma_web_test, ...) intersect attr("tags", "saucelabs", ...)) except attr("tags", "ivy-only", ...) except attr("tags", "fixme-saucelabs-ve", ...)')
57-
yarn bazel test --config=saucelabs ${TESTS}
55+
yarn bazel test --config=saucelabs --config=view-engine ${TESTS}
5856
```
5957

6058
Running all Ivy karma tests in Saucelabs:
6159

6260
``` bash
6361
yarn bazel run //tools/saucelabs:sauce_service_setup
6462
TESTS=$(./node_modules/.bin/bazelisk query --output label '(kind(karma_web_test, ...) intersect attr("tags", "saucelabs", ...)) except attr("tags", "no-ivy-aot", ...) except attr("tags", "fixme-saucelabs-ivy", ...)')
65-
yarn bazel test --config=saucelabs --config=ivy ${TESTS}
63+
yarn bazel test --config=saucelabs ${TESTS}
6664
```
6765

6866
## Under the hood

tools/symbol-extractor/run_all_symbols_extractor_tests.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ const ALL_ACCEPT_TARGETS = ALL_TEST_TARGETS.map(test => `${test}.accept`);
3939
function runBazelCommandOnTargets(command, targets, present) {
4040
for (const target of targets) {
4141
process.stdout.write(`${present}: ${target}`);
42-
const commandResult =
43-
spawnSync('yarn', ['-s', 'bazel', command, '--config=ivy', target], {encoding: 'utf8'});
42+
const commandResult = spawnSync('yarn', ['-s', 'bazel', command, target], {encoding: 'utf8'});
4443
process.stdout.clearLine();
4544
process.stdout.cursorTo(0);
4645
if (commandResult.status) {

0 commit comments

Comments
 (0)