Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove old stamping #2312

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ pkg_npm(
"BUILD.bazel",
"LICENSE",
],
# Don't replace the default 0.0.0-PLACEHOLDER for this pkg_npm since
# we are packaging up the packager itself and this replacement will break it
replace_with_version = "",
substitutions = COMMON_REPLACEMENTS,
deps = [
"//internal:package_contents",
Expand Down
18 changes: 1 addition & 17 deletions internal/pkg_npm/pkg_npm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ PKG_NPM_ATTRS = dict(NODE_CONTEXT_ATTRS, **{
"package_name": attr.string(
doc = """Optional package_name that this npm package may be imported as.""",
),
"replace_with_version": attr.string(
doc = """DEPRECATED: use substitutions instead.

`replace_with_version = "my_version_placeholder"` is just syntax sugar for
`substitutions = {"my_version_placeholder": "{BUILD_SCM_VERSION}"}`.

Follow this deprecation at https://github.com/bazelbuild/rules_nodejs/issues/2158
""",
default = "0.0.0-PLACEHOLDER",
),
"srcs": attr.label_list(
doc = """Files inside this directory which are simply copied into the package.""",
allow_files = True,
Expand Down Expand Up @@ -196,12 +186,6 @@ def create_package(ctx, deps_files, nested_packages):
# current package unless explicitely specified.
filtered_deps_sources = _filter_out_external_files(ctx, deps_files, package_path)

# Back-compat for the replace_with_version stamping
# see https://github.com/bazelbuild/rules_nodejs/issues/2158 for removal
substitutions = dict(**ctx.attr.substitutions)
if stamp and ctx.attr.replace_with_version:
substitutions.setdefault(ctx.attr.replace_with_version, "{BUILD_SCM_VERSION}")

args = ctx.actions.args()
inputs = ctx.files.srcs + deps_files + nested_packages

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

if stamp:
# The version_file is an undocumented attribute of the ctx that lets us read the volatile-status.txt file
Expand Down
5 changes: 4 additions & 1 deletion internal/pkg_npm/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ pkg_npm(
],
nested_packages = [":dependent_pkg"],
node_context_data = ":force_stamp",
substitutions = {"replace_me": "replaced"},
substitutions = {
"0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}",
"replace_me": "replaced",
},
vendor_external = [
"internal_npm_package_test_vendored_external",
],
Expand Down
3 changes: 0 additions & 3 deletions packages/rollup/rollup_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ def _rollup_bundle(ctx):
output = config,
substitutions = {
"bazel_info_file": "\"%s\"" % ctx.info_file.path if stamp else "undefined",
# Back-compat: we used to replace a variable "bazel_stamp_file"
# Remove in 3.0: https://github.com/bazelbuild/rules_nodejs/issues/2158
"bazel_stamp_file": "\"%s\"" % ctx.version_file.path if stamp else "undefined",
"bazel_version_file": "\"%s\"" % ctx.version_file.path if stamp else "undefined",
},
)
Expand Down