Skip to content

Commit 68b18d8

Browse files
Alex Eaglealexeagle
authored andcommitted
chore: remove old stamping
BREAKING CHANGE: - rollup_bundle config_file no longer has substitutions from a "bazel_stamp_file" - use bazel_version_file instead - pkg_npm no longer has replace_with_version attribute, use substitutions instead Fixes #2158
1 parent 2c73fde commit 68b18d8

4 files changed

Lines changed: 5 additions & 24 deletions

File tree

BUILD.bazel

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ pkg_npm(
8080
"BUILD.bazel",
8181
"LICENSE",
8282
],
83-
# Don't replace the default 0.0.0-PLACEHOLDER for this pkg_npm since
84-
# we are packaging up the packager itself and this replacement will break it
85-
replace_with_version = "",
8683
substitutions = COMMON_REPLACEMENTS,
8784
deps = [
8885
"//internal:package_contents",

internal/pkg_npm/pkg_npm.bzl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,6 @@ PKG_NPM_ATTRS = dict(NODE_CONTEXT_ATTRS, **{
8585
"package_name": attr.string(
8686
doc = """Optional package_name that this npm package may be imported as.""",
8787
),
88-
"replace_with_version": attr.string(
89-
doc = """DEPRECATED: use substitutions instead.
90-
91-
`replace_with_version = "my_version_placeholder"` is just syntax sugar for
92-
`substitutions = {"my_version_placeholder": "{BUILD_SCM_VERSION}"}`.
93-
94-
Follow this deprecation at https://github.com/bazelbuild/rules_nodejs/issues/2158
95-
""",
96-
default = "0.0.0-PLACEHOLDER",
97-
),
9888
"srcs": attr.label_list(
9989
doc = """Files inside this directory which are simply copied into the package.""",
10090
allow_files = True,
@@ -196,12 +186,6 @@ def create_package(ctx, deps_files, nested_packages):
196186
# current package unless explicitely specified.
197187
filtered_deps_sources = _filter_out_external_files(ctx, deps_files, package_path)
198188

199-
# Back-compat for the replace_with_version stamping
200-
# see https://github.com/bazelbuild/rules_nodejs/issues/2158 for removal
201-
substitutions = dict(**ctx.attr.substitutions)
202-
if stamp and ctx.attr.replace_with_version:
203-
substitutions.setdefault(ctx.attr.replace_with_version, "{BUILD_SCM_VERSION}")
204-
205189
args = ctx.actions.args()
206190
inputs = ctx.files.srcs + deps_files + nested_packages
207191

@@ -213,7 +197,7 @@ def create_package(ctx, deps_files, nested_packages):
213197
args.add(ctx.genfiles_dir.path)
214198
args.add_joined(filtered_deps_sources, join_with = ",", omit_if_empty = False)
215199
args.add_joined([p.path for p in nested_packages], join_with = ",", omit_if_empty = False)
216-
args.add(substitutions)
200+
args.add(ctx.attr.substitutions)
217201

218202
if stamp:
219203
# The version_file is an undocumented attribute of the ctx that lets us read the volatile-status.txt file

internal/pkg_npm/test/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ pkg_npm(
4747
],
4848
nested_packages = [":dependent_pkg"],
4949
node_context_data = ":force_stamp",
50-
substitutions = {"replace_me": "replaced"},
50+
substitutions = {
51+
"0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}",
52+
"replace_me": "replaced",
53+
},
5154
vendor_external = [
5255
"internal_npm_package_test_vendored_external",
5356
],

packages/rollup/rollup_bundle.bzl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,6 @@ def _rollup_bundle(ctx):
308308
output = config,
309309
substitutions = {
310310
"bazel_info_file": "\"%s\"" % ctx.info_file.path if stamp else "undefined",
311-
# Back-compat: we used to replace a variable "bazel_stamp_file"
312-
# Remove in 3.0: https://github.com/bazelbuild/rules_nodejs/issues/2158
313-
"bazel_stamp_file": "\"%s\"" % ctx.version_file.path if stamp else "undefined",
314311
"bazel_version_file": "\"%s\"" % ctx.version_file.path if stamp else "undefined",
315312
},
316313
)

0 commit comments

Comments
 (0)