Skip to content

Commit 03a9c1d

Browse files
josephperrottjelbourn
authored andcommitted
build: migrate to new --define=angular_ivy_enabled flag (#17792)
Remove all usage of --define=compile=* within the repo, using --config=ivy and --config=view-engine instead. This matches the changes in the angular/angular repo and is clearer to developers what the flag is actually doing.
1 parent f4d0c18 commit 03a9c1d

File tree

7 files changed

+17
-14
lines changed

7 files changed

+17
-14
lines changed

.bazelrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ build:release --workspace_status_command="node ./tools/bazel-stamp-vars.js"
4040
################################
4141
# View Engine / Ivy toggle #
4242
################################
43+
build:view-engine --define=angular_ivy_enabled=False
44+
build:ivy --define=angular_ivy_enabled=True
4345

44-
# Use "legacy" for ViewEngine and "aot" for Ivy
45-
build --define=compile=aot
46+
# Set Ivy as the default
47+
build --config=ivy
4648

4749
#######################
4850
# Remote HTTP Caching #

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ jobs:
403403
- *setup_bazel_binary
404404

405405
# Run project tests with NGC and View Engine.
406-
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e --define=compile=legacy
407-
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --define=compile=legacy
406+
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e --config=view-engine
407+
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine
408408

409409
# ----------------------------------------------------------------------------
410410
# Job that runs all Bazel tests against View Engine from angular/angular#master.
@@ -426,8 +426,8 @@ jobs:
426426
# Setup Angular snapshots by installing the artifacts from the Github repositories.
427427
- run: node ./scripts/circleci/setup-angular-snapshots.js --tag master
428428
# Run project tests with NGC and View Engine.
429-
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e --define=compile=legacy
430-
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --define=compile=legacy
429+
- run: bazel build src/... --build_tag_filters=-docs-package,-e2e --config=view-engine
430+
- run: bazel test src/... --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine
431431

432432
# ----------------------------------------------------------------------------
433433
# Job that runs all Bazel tests against material-components-web#master.

packages.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ ANGULAR_LIBRARY_IVY_UMDS = ANGULAR_NO_NGCC_BUNDLES + [
3939

4040
"""
4141
Gets the list of targets for the Angular library UMD bundles. Conditionally
42-
switches between View Engine or Ivy UMD bundles based on the "--define=compile" flag.
42+
switches between View Engine or Ivy UMD bundles based on the
43+
"--config={ivy,view-engine}" flag.
4344
"""
4445

4546
def getAngularUmdTargets():

scripts/build-packages-dist.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ if (module === require.main) {
4141
* output directory.
4242
*/
4343
function defaultBuildReleasePackages() {
44-
buildReleasePackages('legacy', join(projectDir, 'dist/releases'));
44+
buildReleasePackages(false, join(projectDir, 'dist/releases'));
4545
}
4646

4747
/**
4848
* Builds the release packages with the given compile mode and copies
4949
* the package output into the given directory.
5050
*/
51-
function buildReleasePackages(compileMode, distPath) {
51+
function buildReleasePackages(useIvy, distPath) {
5252
console.log('######################################');
5353
console.log(' Building release packages...');
54-
console.log(` Compile mode: ${compileMode}`);
54+
console.log(` Compiling with Ivy: ${useIvy}`);
5555
console.log('######################################');
5656

5757
// List of targets to build. e.g. "src/cdk:npm_package", or "src/material:npm_package".
@@ -73,7 +73,7 @@ function buildReleasePackages(compileMode, distPath) {
7373

7474
// Build with "--config=release" so that Bazel runs the workspace stamping script. The
7575
// stamping script ensures that the version placeholder is populated in the release output.
76-
exec(`${bazelCmd} build --config=release --define=compile=${compileMode} ${targets.join(' ')}`);
76+
exec(`${bazelCmd} build --config=release --config=${useIvy ? 'ivy' : 'view-engine'} ${targets.join(' ')}`);
7777

7878
// Delete the distribution directory so that the output is guaranteed to be clean. Re-create
7979
// the empty directory so that we can copy the release packages into it later.

src/dev-app/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ sass_binary(
9999

100100
expand_template(
101101
name = "system-config",
102-
configuration_env_vars = ["compile"],
102+
configuration_env_vars = ["angular_ivy_enabled"],
103103
output_name = "system-config.js",
104104
substitutions = {
105105
"$CDK_ENTRYPOINTS_TMPL": str(CDK_ENTRYPOINTS),

src/dev-app/system-config-tmpl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var MATERIAL_PACKAGES = $MATERIAL_ENTRYPOINTS_TMPL;
1616
var MATERIAL_EXPERIMENTAL_PACKAGES = $MATERIAL_EXPERIMENTAL_ENTRYPOINTS_TMPL;
1717

1818
/** Whether the dev-app is served with Ivy enabled. */
19-
var isRunningWithIvy = '$COMPILE_TMPL' === 'aot';
19+
var isRunningWithIvy = '$ANGULAR_IVY_ENABLED_TMPL'.toString() === 'True';
2020

2121
/** Bazel runfile path referring to the "src/" folder of the project. */
2222
var srcRunfilePath = 'angular_material/src';

tools/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ platform(
1717
config_setting(
1818
name = "view_engine_mode",
1919
values = {
20-
"define": "compile=legacy",
20+
"define": "angular_ivy_enabled=False",
2121
},
2222
)

0 commit comments

Comments
 (0)