Ensures that the "core_all:size_test" target runs with "--define=compile=aot". 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. PR Close #32613
57 lines
1.5 KiB
Python
57 lines
1.5 KiB
Python
# 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
|
|
|
|
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "nodejs_test")
|
|
|
|
"""
|
|
Macro that can be used to track the size of a given input file by inspecting
|
|
the corresponding source map. A golden file is used to compare the current
|
|
file size data against previously approved file size data
|
|
"""
|
|
|
|
def js_size_tracking_test(
|
|
name,
|
|
src,
|
|
source_map,
|
|
golden_file,
|
|
max_percentage_diff,
|
|
max_byte_diff,
|
|
required_compile_mode = "",
|
|
data = [],
|
|
**kwargs):
|
|
all_data = data + [
|
|
"//tools/size-tracking",
|
|
"@npm//source-map",
|
|
"@npm//chalk",
|
|
]
|
|
entry_point = "//tools/size-tracking:index.ts"
|
|
|
|
nodejs_test(
|
|
name = name,
|
|
data = all_data,
|
|
entry_point = entry_point,
|
|
configuration_env_vars = ["compile"],
|
|
templated_args = [
|
|
src,
|
|
source_map,
|
|
golden_file,
|
|
"%d" % max_percentage_diff,
|
|
"%d" % max_byte_diff,
|
|
"false",
|
|
required_compile_mode,
|
|
],
|
|
**kwargs
|
|
)
|
|
|
|
nodejs_binary(
|
|
name = "%s.accept" % name,
|
|
testonly = True,
|
|
data = all_data,
|
|
entry_point = entry_point,
|
|
configuration_env_vars = ["compile"],
|
|
templated_args = [src, source_map, golden_file, "0", "0", "true", required_compile_mode],
|
|
**kwargs
|
|
)
|