mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
build: support template make variables in nodejs_binary/test (#48521)
We modified the macros of `nodejs_binary/test` to have a rule in between that requests the `.mjs` output. This works fine but breaks make variable substitution for `templated_args` because Bazel requires referenced labels to be part of the explicit `data`. The rule in between breaks this, so we add a new argument that can be used for such "template"/"args" data dependencies. This can be removed when everything is ESM and we don't need the rule in between. PR Close #48521
This commit is contained in:
parent
d3d22a9009
commit
eac5280bec
3 changed files with 10 additions and 12 deletions
|
|
@ -15,8 +15,9 @@ MADGE_CONFIG_LABEL = "//tools/circular_dependency_test:madge-resolve.config.js"
|
|||
def circular_dependency_test(name, deps, entry_point, **kwargs):
|
||||
nodejs_test(
|
||||
name = name,
|
||||
data = ["@npm//madge", MADGE_CONFIG_LABEL] + deps,
|
||||
data = ["@npm//madge"] + deps,
|
||||
entry_point = "@npm//:node_modules/madge/bin/cli.js",
|
||||
data_for_args = [MADGE_CONFIG_LABEL],
|
||||
templated_args = [
|
||||
"--circular",
|
||||
"--no-spinner",
|
||||
|
|
|
|||
|
|
@ -389,6 +389,7 @@ def nodejs_binary(
|
|||
testonly = False,
|
||||
data = [],
|
||||
env = {},
|
||||
data_for_args = [],
|
||||
templated_args = [],
|
||||
enable_linker = False,
|
||||
**kwargs):
|
||||
|
|
@ -414,7 +415,7 @@ def nodejs_binary(
|
|||
|
||||
_nodejs_binary(
|
||||
name = name,
|
||||
data = [":%s_esm_deps" % name] + rule_data,
|
||||
data = [":%s_esm_deps" % name] + rule_data + data_for_args,
|
||||
testonly = testonly,
|
||||
entry_point = entry_point.replace(".js", ".mjs"),
|
||||
env = env,
|
||||
|
|
@ -423,7 +424,7 @@ def nodejs_binary(
|
|||
**kwargs
|
||||
)
|
||||
|
||||
def nodejs_test(name, data = [], env = {}, templated_args = [], enable_linker = False, **kwargs):
|
||||
def nodejs_test(name, data = [], env = {}, data_for_args = [], templated_args = [], enable_linker = False, **kwargs):
|
||||
rule_data = []
|
||||
(templated_args, rule_data) = install_esm_loaders(templated_args, rule_data)
|
||||
|
||||
|
|
@ -445,7 +446,7 @@ def nodejs_test(name, data = [], env = {}, templated_args = [], enable_linker =
|
|||
|
||||
_nodejs_test(
|
||||
name = name,
|
||||
data = [":%s_esm_deps" % name] + rule_data,
|
||||
data = [":%s_esm_deps" % name] + rule_data + data_for_args,
|
||||
env = env,
|
||||
templated_args = templated_args,
|
||||
use_esm = True,
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ def js_expected_symbol_test(name, src, golden, data = [], **kwargs):
|
|||
"""This test verifies that a set of top level symbols from a javascript file match a gold file.
|
||||
"""
|
||||
all_data = data + [
|
||||
src,
|
||||
golden,
|
||||
Label("//tools/symbol-extractor:lib"),
|
||||
Label("@npm//typescript"),
|
||||
]
|
||||
|
|
@ -25,9 +23,8 @@ def js_expected_symbol_test(name, src, golden, data = [], **kwargs):
|
|||
data = all_data,
|
||||
entry_point = entry_point,
|
||||
tags = kwargs.pop("tags", []) + ["symbol_extractor"],
|
||||
# Disable the linker and rely on patched resolution which works better on Windows
|
||||
# and is less prone to race conditions when targets build concurrently.
|
||||
templated_args = ["--nobazel_run_linker", "$(rootpath %s)" % src, "$(rootpath %s)" % golden],
|
||||
data_for_args = [src, golden],
|
||||
templated_args = ["$(rootpath %s)" % src, "$(rootpath %s)" % golden],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
|
@ -36,8 +33,7 @@ def js_expected_symbol_test(name, src, golden, data = [], **kwargs):
|
|||
testonly = True,
|
||||
data = all_data,
|
||||
entry_point = entry_point,
|
||||
# Disable the linker and rely on patched resolution which works better on Windows
|
||||
# and is less prone to race conditions when targets build concurrently.
|
||||
templated_args = ["--nobazel_run_linker", "$(rootpath %s)" % src, "$(rootpath %s)" % golden, "--accept"],
|
||||
data_for_args = [src, golden],
|
||||
templated_args = ["$(rootpath %s)" % src, "$(rootpath %s)" % golden, "--accept"],
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue