build: migrate determining if Ivy is enabled in typescript genrule files to use angular_ivy_enabled (#33983)
Use angular_ivy_enabled to determine if Ivy is being used for the ivy_test_selector.ts symbols. Additionally, remove the reflect_metadata genrules as we not longer have a "jit" compile option so all possible invocations result in the same generated file. Instead we can just commit this file. PR Close #33983
This commit is contained in:
parent
4022376b3f
commit
807c89441a
|
@ -28,6 +28,10 @@ ng_rollup_bundle(
|
||||||
js_size_tracking_test(
|
js_size_tracking_test(
|
||||||
name = "size_test",
|
name = "size_test",
|
||||||
src = "angular/packages/core/test/bundling/core_all/bundle.min.js",
|
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 = [
|
data = [
|
||||||
"bundle.golden_size_map_ivy.json",
|
"bundle.golden_size_map_ivy.json",
|
||||||
":bundle",
|
":bundle",
|
||||||
|
@ -35,10 +39,6 @@ js_size_tracking_test(
|
||||||
golden_file = "angular/packages/core/test/bundling/core_all/bundle.golden_size_map_ivy.json",
|
golden_file = "angular/packages/core/test/bundling/core_all/bundle.golden_size_map_ivy.json",
|
||||||
max_byte_diff = 250,
|
max_byte_diff = 250,
|
||||||
max_percentage_diff = 15,
|
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",
|
source_map = "angular/packages/core/test/bundling/core_all/bundle.min.js.map",
|
||||||
tags = [
|
tags = [
|
||||||
"ivy-only",
|
"ivy-only",
|
||||||
|
@ -49,6 +49,10 @@ js_size_tracking_test(
|
||||||
js_size_tracking_test(
|
js_size_tracking_test(
|
||||||
name = "size_test_view_engine",
|
name = "size_test_view_engine",
|
||||||
src = "angular/packages/core/test/bundling/core_all/bundle.min.js",
|
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 = [
|
data = [
|
||||||
"bundle.golden_size_map_view_engine.json",
|
"bundle.golden_size_map_view_engine.json",
|
||||||
":bundle",
|
":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",
|
golden_file = "angular/packages/core/test/bundling/core_all/bundle.golden_size_map_view_engine.json",
|
||||||
max_byte_diff = 250,
|
max_byte_diff = 250,
|
||||||
max_percentage_diff = 15,
|
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",
|
source_map = "angular/packages/core/test/bundling/core_all/bundle.min.js.map",
|
||||||
tags = [
|
tags = [
|
||||||
"manual",
|
"manual",
|
||||||
|
|
|
@ -6,19 +6,9 @@ package(default_visibility = ["//visibility:public"])
|
||||||
ts_library(
|
ts_library(
|
||||||
name = "reflect_metadata",
|
name = "reflect_metadata",
|
||||||
srcs = [
|
srcs = [
|
||||||
"src/reflect_metadata_aot.ts",
|
"src/reflect_metadata.ts",
|
||||||
"src/reflect_metadata_jit.ts",
|
|
||||||
"src/reflect_metadata_legacy.ts",
|
|
||||||
":metadata_switch",
|
|
||||||
],
|
],
|
||||||
module_name = "@angular/core/test/bundling/util/src/reflect_metadata",
|
module_name = "@angular/core/test/bundling/util/src/reflect_metadata",
|
||||||
module_root = "src/reflect_metadata",
|
module_root = "src/reflect_metadata",
|
||||||
deps = ["@npm//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)';\" > $@",
|
|
||||||
)
|
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import './reflect_metadata_legacy';
|
export const UNUSED = true;
|
||||||
|
|
|
@ -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';
|
|
|
@ -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;
|
|
|
@ -21,14 +21,14 @@ ng_module(
|
||||||
|
|
||||||
## Controls if Ivy is enabled. (Temporary target until we permanently switch over to Ivy)
|
## 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
|
## This file generates `src/angular_ivy_enabled.ts` file which exports a truthy value
|
||||||
## `--define=compile` value as `bazelDefineCompileValue` symbols so that runtime can detect
|
## whether Ivy should be enabled based on the `--defined=angular_ivy_enabled` value so
|
||||||
## which mode it is running in.
|
## runtime can detect which mode it is running in.
|
||||||
##
|
##
|
||||||
## See: `//.bazelrc` where `--define=ivy=legacy` is defined as default.
|
## See: `//.bazelrc` where `--define=angular_ivy_enabled=false` is defined as default.
|
||||||
## See: `./src/bazel_define_compile_value.ts` for more details.
|
## See: `./src/angular_ivy_enabled.ts` for more details.
|
||||||
genrule(
|
genrule(
|
||||||
name = "bazel_define_compile_value",
|
name = "angular_ivy_enabled",
|
||||||
outs = ["src/bazel_define_compile_value.ts"],
|
outs = ["src/angular_ivy_enabled.ts"],
|
||||||
cmd = "echo export const bazelDefineCompileValue = \"'$(compile)'\"\; > $@",
|
cmd = "echo export const ivyEnabled = \"'True'.toString() == '$(angular_ivy_enabled)'\"\; > $@",
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,4 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* 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;
|
|
@ -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';
|
|
|
@ -5,8 +5,7 @@
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
* 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
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
import {ivyEnabled} from './angular_ivy_enabled';
|
||||||
import {bazelDefineCompileValue} from './bazel_define_compile_value';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function to conditionally include a test or a block of tests only when tests run against Ivy.
|
* 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(...);
|
* 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
|
* A function to conditionally skip the execution of tests that are not relevant when
|
||||||
|
|
Loading…
Reference in New Issue