mirror of
https://github.com/bazel-contrib/bazel-lib
synced 2024-12-02 10:15:22 +00:00
8a11a106db
Greg convinced me that users will get really slow stamped builds because most run_binary tools don't actually read the status files, but will be cache-invalidated.
35 lines
685 B
Python
35 lines
685 B
Python
load(":stamp_aware_rule.bzl", "my_stamp_aware_rule")
|
|
load("//lib:run_binary.bzl", "run_binary")
|
|
|
|
my_stamp_aware_rule(
|
|
name = "test_stamped",
|
|
out = "always",
|
|
stamp = 1,
|
|
)
|
|
|
|
my_stamp_aware_rule(
|
|
name = "test_unstamped",
|
|
out = "never",
|
|
stamp = 0,
|
|
)
|
|
|
|
my_stamp_aware_rule(
|
|
name = "test_default",
|
|
out = "default",
|
|
)
|
|
|
|
sh_binary(
|
|
name = "stamper",
|
|
srcs = ["stamper.sh"],
|
|
)
|
|
|
|
# Build this with --stamp enabled to see your username in the resulting output file
|
|
run_binary(
|
|
name = "run_stamper",
|
|
outs = ["stamped"],
|
|
args = ["$(location stamped)"],
|
|
# Include status files as inputs when --stamp is set.
|
|
stamp = -1,
|
|
tool = "stamper",
|
|
)
|