build: fix bazel stamping (#22965)

As pointed out in https://github.com/bazelbuild/rules_nodejs/issues/156
our mechanism would never pick up changes to the version info.

PR Close #22965
This commit is contained in:
Alex Eagle
2018-03-23 11:34:18 -07:00
committed by Alex Rickabaugh
parent e1ea7ed019
commit 0b348c8ffe
6 changed files with 8 additions and 22 deletions

View File

@ -1,11 +1 @@
exports_files(["tsconfig.json"])
# Executes the workspace_status_command and provides the result.
# See the section on stamping in docs/BAZEL.md
genrule(
name = "stamp_data",
outs = ["stamp_data.txt"],
cmd = "cat bazel-out/volatile-status.txt > $@",
stamp = True,
visibility = ["//:__subpackages__"],
)

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash
# Generates the data used by the stamping feature in bazel.
# A genrule with stamp=1 can read the resulting file from bazel-out/volatile-status.txt
# See the section on stamping in docs/BAZEL.md
set -u -e -E -o pipefail

View File

@ -45,26 +45,22 @@ def ng_module(name, tsconfig = None, entry_point = None, **kwargs):
entry_point = "public_api.ts"
_ng_module(name = name, flat_module_out_file = name, tsconfig = tsconfig, entry_point = entry_point, **kwargs)
def ng_package(name, readme_md = None, license_banner = None, stamp_data = None, **kwargs):
def ng_package(name, readme_md = None, license_banner = None, **kwargs):
if not readme_md:
readme_md = "//packages:README.md"
if not license_banner:
license_banner = "//packages:license-banner.txt"
if not stamp_data:
stamp_data = "//tools:stamp_data"
_ng_package(
name = name,
readme_md = readme_md,
license_banner = license_banner,
stamp_data = stamp_data,
replacements = PKG_GROUP_REPLACEMENTS,
**kwargs)
def npm_package(name, replacements = {}, **kwargs):
_npm_package(
name = name,
stamp_data = "//tools:stamp_data",
replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS),
**kwargs)