diff --git a/packages/core/test/bundling/core_all/BUILD.bazel b/packages/core/test/bundling/core_all/BUILD.bazel index 8a05dcf2b1..f6ac54dbe7 100644 --- a/packages/core/test/bundling/core_all/BUILD.bazel +++ b/packages/core/test/bundling/core_all/BUILD.bazel @@ -28,6 +28,10 @@ ng_rollup_bundle( js_size_tracking_test( name = "size_test", src = "angular/packages/core/test/bundling/core_all/bundle.min.js", + # Ensures that this target runs with "--config=ivy" (aka Ivy). This is necessary + # because we don't run this test on CI currently, but if we run it manually, we need to + # ensure that it runs with Ivy for proper size comparisons. + angular_ivy_enabled = "True", data = [ "bundle.golden_size_map_ivy.json", ":bundle", @@ -35,10 +39,6 @@ js_size_tracking_test( golden_file = "angular/packages/core/test/bundling/core_all/bundle.golden_size_map_ivy.json", max_byte_diff = 250, max_percentage_diff = 15, - # Ensures that this target runs with "--define=compile=aot" (aka Ivy). This is necessary - # because we don't run this test on CI currently, but if we run it manually, we need to - # ensure that it runs with Ivy for proper size comparisons. - required_compile_mode = "aot", source_map = "angular/packages/core/test/bundling/core_all/bundle.min.js.map", tags = [ "ivy-only", @@ -49,6 +49,10 @@ js_size_tracking_test( js_size_tracking_test( name = "size_test_view_engine", src = "angular/packages/core/test/bundling/core_all/bundle.min.js", + # Ensures that this target runs with `--config=view-engine`. This is + # necessary because we don't run this test on CI currently, but if we run it manually, + # we need to ensure that it runs with View Engine for proper size comparisons. + angular_ivy_enabled = "False", data = [ "bundle.golden_size_map_view_engine.json", ":bundle", @@ -56,10 +60,6 @@ js_size_tracking_test( golden_file = "angular/packages/core/test/bundling/core_all/bundle.golden_size_map_view_engine.json", max_byte_diff = 250, max_percentage_diff = 15, - # Ensures that this target runs with "--define=compile=legacy" (View Engine). This is - # necessary because we don't run this test on CI currently, but if we run it manually, - # we need to ensure that it runs with View Engine for proper size comparisons. - required_compile_mode = "legacy", source_map = "angular/packages/core/test/bundling/core_all/bundle.min.js.map", tags = [ "manual", diff --git a/packages/core/test/bundling/util/BUILD.bazel b/packages/core/test/bundling/util/BUILD.bazel index 8ca5d4470c..fbe4284e0b 100644 --- a/packages/core/test/bundling/util/BUILD.bazel +++ b/packages/core/test/bundling/util/BUILD.bazel @@ -6,19 +6,9 @@ package(default_visibility = ["//visibility:public"]) ts_library( name = "reflect_metadata", srcs = [ - "src/reflect_metadata_aot.ts", - "src/reflect_metadata_jit.ts", - "src/reflect_metadata_legacy.ts", - ":metadata_switch", + "src/reflect_metadata.ts", ], module_name = "@angular/core/test/bundling/util/src/reflect_metadata", module_root = "src/reflect_metadata", deps = ["@npm//reflect-metadata"], ) - -# See packages/core/BUILD.bazel. -genrule( - name = "metadata_switch", - outs = ["src/reflect_metadata.ts"], - cmd = "echo import \"'./reflect_metadata_$(compile)';\" > $@", -) diff --git a/packages/core/test/bundling/util/src/reflect_metadata.ts b/packages/core/test/bundling/util/src/reflect_metadata.ts index 88c74cc7c2..d83b208107 100644 --- a/packages/core/test/bundling/util/src/reflect_metadata.ts +++ b/packages/core/test/bundling/util/src/reflect_metadata.ts @@ -6,4 +6,4 @@ * found in the LICENSE file at https://angular.io/license */ -import './reflect_metadata_legacy'; +export const UNUSED = true; diff --git a/packages/core/test/bundling/util/src/reflect_metadata_jit.ts b/packages/core/test/bundling/util/src/reflect_metadata_jit.ts deleted file mode 100644 index 4c37fe91ba..0000000000 --- a/packages/core/test/bundling/util/src/reflect_metadata_jit.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import 'reflect-metadata'; diff --git a/packages/core/test/bundling/util/src/reflect_metadata_legacy.ts b/packages/core/test/bundling/util/src/reflect_metadata_legacy.ts deleted file mode 100644 index d83b208107..0000000000 --- a/packages/core/test/bundling/util/src/reflect_metadata_legacy.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -export const UNUSED = true; diff --git a/packages/private/testing/BUILD.bazel b/packages/private/testing/BUILD.bazel index 90299288c5..549768807d 100644 --- a/packages/private/testing/BUILD.bazel +++ b/packages/private/testing/BUILD.bazel @@ -21,14 +21,14 @@ ng_module( ## Controls if Ivy is enabled. (Temporary target until we permanently switch over to Ivy) ## -## This file generates `src/bazel_define_compile_value.ts` file which reexports -## `--define=compile` value as `bazelDefineCompileValue` symbols so that runtime can detect -## which mode it is running in. +## This file generates `src/angular_ivy_enabled.ts` file which exports a truthy value +## whether Ivy should be enabled based on the `--defined=angular_ivy_enabled` value so +## runtime can detect which mode it is running in. ## -## See: `//.bazelrc` where `--define=ivy=legacy` is defined as default. -## See: `./src/bazel_define_compile_value.ts` for more details. +## See: `//.bazelrc` where `--define=angular_ivy_enabled=false` is defined as default. +## See: `./src/angular_ivy_enabled.ts` for more details. genrule( - name = "bazel_define_compile_value", - outs = ["src/bazel_define_compile_value.ts"], - cmd = "echo export const bazelDefineCompileValue = \"'$(compile)'\"\; > $@", + name = "angular_ivy_enabled", + outs = ["src/angular_ivy_enabled.ts"], + cmd = "echo export const ivyEnabled = \"'True'.toString() == '$(angular_ivy_enabled)'\"\; > $@", ) diff --git a/packages/core/test/bundling/util/src/reflect_metadata_aot.ts b/packages/private/testing/src/angular_ivy_enabled.ts similarity index 66% rename from packages/core/test/bundling/util/src/reflect_metadata_aot.ts rename to packages/private/testing/src/angular_ivy_enabled.ts index d83b208107..1d119f5ddc 100644 --- a/packages/core/test/bundling/util/src/reflect_metadata_aot.ts +++ b/packages/private/testing/src/angular_ivy_enabled.ts @@ -6,4 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -export const UNUSED = true; +/** + * This variable shows if Ivy should be enabled at runtime. + */ +export const ivyEnabled = false; diff --git a/packages/private/testing/src/bazel_define_compile_value.ts b/packages/private/testing/src/bazel_define_compile_value.ts deleted file mode 100644 index 714f4a437f..0000000000 --- a/packages/private/testing/src/bazel_define_compile_value.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * This variable shows the `blaze --define=compile=` value to make it available to runtime. - */ -export const bazelDefineCompileValue = 'legacy'; diff --git a/packages/private/testing/src/ivy_test_selectors.ts b/packages/private/testing/src/ivy_test_selectors.ts index 02fdd3a819..8cec3ec2ba 100644 --- a/packages/private/testing/src/ivy_test_selectors.ts +++ b/packages/private/testing/src/ivy_test_selectors.ts @@ -5,8 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ - -import {bazelDefineCompileValue} from './bazel_define_compile_value'; +import {ivyEnabled} from './angular_ivy_enabled'; /** * A function to conditionally include a test or a block of tests only when tests run against Ivy. @@ -24,7 +23,7 @@ import {bazelDefineCompileValue} from './bazel_define_compile_value'; * ivyEnabled && it(...); * ``` */ -export const ivyEnabled = 'aot' === (bazelDefineCompileValue as string); +export {ivyEnabled}; /** * A function to conditionally skip the execution of tests that are not relevant when