build: use an unstamped version of compiler-cli for running the angular compiler in ng_project (#61479)

Use an unstamped version of the compiler when it runs in `ng_project` as it will get stamped appropriately
whenever the generated code gets stamped after its usage."

PR Close #61479
This commit is contained in:
Joey Perrott 2025-05-19 18:37:17 +00:00 committed by Jessica Janiuk
parent 447b2a3690
commit abdfbefe74
2 changed files with 15 additions and 2 deletions

View file

@ -148,14 +148,14 @@ pkg_npm(
# Long-term, `pkg_npm` will be migrated to `npm_package` in general.
npm_package(
name = "pkg",
srcs = [":npm_package"],
srcs = [":npm_package_nosub"],
data = [
# Needed because compiler is a dev dependency (to satisfy the peer dependency)
# and `rules_js` only makes transitive production dependencies available.
":node_modules/@angular/compiler",
],
replace_prefixes = {
"npm_package/": "",
"npm_package_nosub/": "",
},
)

View file

@ -214,6 +214,7 @@ def ng_package(name, readme_md = None, license_banner = None, license = None, de
def pkg_npm(name, deps = [], validate = True, **kwargs):
"""Default values for pkg_npm"""
visibility = kwargs.pop("visibility", None)
tags = kwargs.pop("tags", [])
common_substitutions = dict(kwargs.pop("substitutions", {}), **PKG_GROUP_REPLACEMENTS)
substitutions = dict(common_substitutions, **{
@ -247,6 +248,18 @@ def pkg_npm(name, deps = [], validate = True, **kwargs):
}),
deps = [":%s_js_module_output" % name],
visibility = visibility,
tags = tags,
**kwargs
)
_pkg_npm(
name = "%s_nosub" % name,
validate = validate,
substitutions = common_substitutions,
deps = [":%s_js_module_output" % name],
visibility = visibility,
# should not be built unless it is a dependency of another rule
tags = ["manual"],
**kwargs
)