From 7f6bb91c5d70eb6abdd756e2cba003fd227a0229 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Tue, 20 May 2025 19:56:21 +0000 Subject: [PATCH] build: update compiler-cli to not be stamped when used for the compiler in ng_project (#61535) The compiler-cli package needs to be unstamped and will the resulting generated code will be stamped as expected. PR Close #61535 --- packages/compiler-cli/BUILD.bazel | 4 ++-- packages/compiler/BUILD.bazel | 4 ++-- tools/defaults.bzl | 31 ++++++++++++++++++------------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index a3e52356315..dc0208af858 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -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_nosub"], + srcs = [":npm_package"], 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_nosub/": "", + "npm_package/": "", }, ) diff --git a/packages/compiler/BUILD.bazel b/packages/compiler/BUILD.bazel index 15e9277968f..993a290899f 100644 --- a/packages/compiler/BUILD.bazel +++ b/packages/compiler/BUILD.bazel @@ -48,9 +48,9 @@ ng_package( # Long-term, `pkg_npm` will be migrated to `npm_package` in general. npm_package( name = "pkg", - srcs = [":npm_package"], + srcs = [":npm_package_nosub"], replace_prefixes = { - "npm_package/": "", + "npm_package_nosub/": "", }, ) diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 07a2af13669..0357ed58672 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -174,6 +174,7 @@ def ng_package(name, readme_md = None, license_banner = None, license = None, de if not license: license = "//:LICENSE" visibility = kwargs.pop("visibility", None) + tags = kwargs.pop("tags", []) common_substitutions = dict(kwargs.pop("substitutions", {}), **PKG_GROUP_REPLACEMENTS) substitutions = dict(common_substitutions, **{ @@ -198,6 +199,23 @@ def ng_package(name, readme_md = None, license_banner = None, license = None, de rollup_config_tmpl = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP_CONFIG_TMPL, rollup = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP, visibility = visibility, + tags = tags, + **kwargs + ) + + _ng_package( + name = "%s_nosub" % name, + deps = deps, + validate = True, + readme_md = readme_md, + license = license, + license_banner = license_banner, + substitutions = common_substitutions, + ng_packager = _INTERNAL_NG_PACKAGE_PACKAGER, + rollup_config_tmpl = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP_CONFIG_TMPL, + rollup = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP, + visibility = visibility, + tags = ["manual"], **kwargs ) @@ -214,7 +232,6 @@ 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, **{ @@ -248,18 +265,6 @@ 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 )