Skip to content

Commit

Permalink
build: migrate references and scripts that set to build with ivy via …
Browse files Browse the repository at this point in the history
…compile=aot to use config=ivy (angular#33983)

Since config=ivy now sets the define=compile flag and the define=angular_ivy_enabled
flag to cause usage of Ivy, we can update all of the documentation and scripts that
reference compile=aot to use config=ivy.

PR Close angular#33983
  • Loading branch information
josephperrott authored and matsko committed Nov 26, 2019
1 parent f9def8c commit 5e3f6d2
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .vscode/recommended-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"program": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test/acceptance",
"--config=debug"
],
Expand All @@ -54,7 +54,7 @@
"program": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test/render3",
"--config=debug"
],
Expand All @@ -71,7 +71,7 @@
"program": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test",
"--config=debug"
],
Expand Down
8 changes: 4 additions & 4 deletions .vscode/recommended-tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test",
"packages/core/test/acceptance",
"packages/core/test/render3",
Expand Down Expand Up @@ -42,7 +42,7 @@
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test/acceptance",
],
"group": "test",
Expand Down Expand Up @@ -71,7 +71,7 @@
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test",
],
"group": "test",
Expand Down Expand Up @@ -100,7 +100,7 @@
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--define=compile=aot",
"--config=ivy",
"packages/core/test/render3",
],
"group": "test",
Expand Down
13 changes: 6 additions & 7 deletions docs/BAZEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ keeps the outputs up-to-date as you save sources.

If you're experiencing problems with seemingly unrelated tests failing, it may be because you're not using the proper flags with your Bazel test runs in Angular.

See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=compile=legacy` is defined as default.
See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=angular_ivy_enabled=False` is defined as default.

- `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below)
- `--test_arg=--node_options=--inspect=9228`: change the inspector port.
- `--define=compile=<option>` Controls if ivy or legacy mode is enabled. This switches which compiler is used (ngc, ngtsc, or a tsc pass-through mode).
- `legacy`: (default behavior) compile against View Engine, e.g. `--define=compile=legacy`
- `aot`: Compile in ivy AOT mode, e.g. `--define=compile=aot`
- `--config=ivy` Enables ivy mode if present, otherwise ViewEngine is used. This switches which compiler is used (ngc or ngtsc)
- `--config=view-engine` Enables ViewEngine mode if present, currentl this the default mode. This switches which compiler is used (ngc or ngtsc)
- `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config of your rules in any given `BUILD.bazel`.
- `no-ivy-aot`: Useful for excluding build and test targets that are not meant to be executed in Ivy AOT mode (`--define=compile=aot`).
- `ivy-only`: Useful for excluding all Ivy build and tests targets with `--define=compile=legacy`.
- `fixme-ivy-aot`: Useful for including/excluding build and test targets that are currently broken in Ivy AOT mode (`--define=compile=aot`).
- `no-ivy-aot`: Useful for excluding build and test targets that are not meant to be executed in Ivy AOT mode (`--config=ivy`).
- `ivy-only`: Useful for excluding all Ivy build and tests targets with `--config=view-engine`.
- `fixme-ivy-aot`: Useful for including/excluding build and test targets that are currently broken in Ivy AOT mode (`--config=ivy`).


### Debugging a Node Test
Expand Down
10 changes: 5 additions & 5 deletions docs/DEBUG_MATERIAL_IVY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ node ./scripts/ci/update-deps-to-dist-packages.js {COMPONENTS_REPO}/package.json
following command:

```bash
yarn test --deleted_packages=//src/dev-app --define=compile=aot
yarn test --deleted_packages=//src/dev-app --config=ivy
```

### Running tests for individual entry-points
Expand All @@ -31,10 +31,10 @@ and entry-points. Running tests for an individual entry-point is possible by exp
selecting a given test target.

Here is an example of commands that run individual test targets. Note that it is
**important** to specify the `--define=compile=aot` flag in order to run tests with Ivy.
**important** to specify the `--config=ivy` flag in order to run tests with Ivy.

```bash
yarn bazel test --define=compile=aot src/material/slider:unit_tests
yarn bazel test --define=compile=aot src/cdk/a11y:unit_tests
yarn bazel test --define=compile=aot src/material/toolbar:unit_tests
yarn bazel test --config=ivy src/material/slider:unit_tests
yarn bazel test --config=ivy src/cdk/a11y:unit_tests
yarn bazel test --config=ivy src/material/toolbar:unit_tests
```
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"update-webdriver": "webdriver-manager update --gecko false $CI_CHROMEDRIVER_VERSION_ARG",
"check-env": "gulp check-env",
"commitmsg": "node ./scripts/git/commit-msg.js",
"test-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot",
"test-ivy-aot": "bazel test --config=ivy --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot",
"test-non-ivy": "bazel test --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only",
"test-fixme-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot --test_tag_filters=-no-ivy-aot",
"test-fixme-ivy-aot": "bazel test --config=ivy --build_tag_filters=-no-ivy-aot --test_tag_filters=-no-ivy-aot",
"list-fixme-ivy-targets": "bazel query --output=label 'attr(\"tags\", \"\\[.*fixme-ivy.*\\]\", //...) except kind(\"sh_binary\", //...) except kind(\"devmode_js_sources\", //...)' | sort",
"bazel": "bazel",
"//circleci-win-comment": "See the test-win circleci job for why these are needed. If they are not needed anymore, remove them.",
"circleci-win-ve": "bazel test --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-browser:chromium-local //packages/compiler-cli/...",
"circleci-win-ivy": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local //packages/compiler-cli/..."
"circleci-win-ivy": "bazel test --config=ivy --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local //packages/compiler-cli/..."
},
"// 1": "dependencies are used locally and by bazel",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/test/compliance/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Tests in this directory should be run with:

```
yarn bazel test --define=compile=aot packages/compiler-cli/test/compliance:compliance
yarn bazel test --config=ivy packages/compiler-cli/test/compliance:compliance
```
2 changes: 1 addition & 1 deletion packages/core/src/render3/util/global_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {getComponent, getContext, getDebugNode, getDirectives, getHostElement, g
*
* To see this in action run the following command:
*
* bazel run --define=compile=aot
* bazel run --config=ivy
* //packages/core/test/bundling/todo:devserver
*
* Then load `localhost:5432` and start using the console tools.
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/render3/perf/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Build

```
yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.es2015.js --define=compile=aot
yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.es2015.js --config=ivy
```

### Run
Expand Down Expand Up @@ -72,9 +72,9 @@ The resulting output should look something like this:
### Notes

To run the benchmark use `bazel run <benchmark_target>`, example:
- `yarn bazel run --define=compile=aot //packages/core/test/render3/perf:noop_change_detection`
- `yarn bazel run --config=ivy //packages/core/test/render3/perf:noop_change_detection`

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

To interactively edit/rerun benchmarks use `ibazel` instead of `bazel`.
2 changes: 1 addition & 1 deletion packages/core/test/render3/perf/profile_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const profileTests =

// build tests
shell.exec(
`yarn bazel build --define=compile=aot ` +
`yarn bazel build --config=ivy ` +
profileTests.map((name) => `//packages/core/test/render3/perf:${name}_lib.min_debug.es2015.js`)
.join(' '));

Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/render3/perf/profile_in_browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</script>
<body>
<ol>
<li>Build the benchmark using <tt>yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.es2015.js --define=compile=aot</tt></li>
<li>Build the benchmark using <tt>yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.es2015.js --config=ivy</tt></li>
<li>Open this file using the <tt>file://</tt> protocol and add <tt>?benchmark=BENCHMARK</tt> to the URL.</li>
<li>Open debug console for details</li>
</ol>
</body>
</html>
</html>

0 comments on commit 5e3f6d2

Please sign in to comment.