2022-08-20 19:53:12 +00:00
|
|
|
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
2022-07-15 05:32:39 +00:00
|
|
|
load("//lib:run_binary.bzl", "run_binary")
|
2023-09-29 21:42:33 +00:00
|
|
|
load(":stamp_aware_rule.bzl", "my_stamp_aware_rule")
|
2022-07-15 05:32:39 +00:00
|
|
|
|
|
|
|
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)"],
|
2022-07-15 16:20:43 +00:00
|
|
|
# Include status files as inputs when --stamp is set.
|
|
|
|
stamp = -1,
|
2022-07-15 05:32:39 +00:00
|
|
|
tool = "stamper",
|
|
|
|
)
|
2022-08-20 19:53:12 +00:00
|
|
|
|
|
|
|
bzl_library(
|
|
|
|
name = "stamp_aware_rule",
|
|
|
|
srcs = ["stamp_aware_rule.bzl"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = ["//lib:stamping"],
|
|
|
|
)
|