experiment: stamp env vars only
diff --git a/lib/private/run_binary.bzl b/lib/private/run_binary.bzl
index 3016790..7ade274 100644
--- a/lib/private/run_binary.bzl
+++ b/lib/private/run_binary.bzl
@@ -59,13 +59,14 @@
for k, v in ctx.attr.env.items():
envs[k] = " ".join([expand_variables(ctx, e, outs = outputs, attribute_name = "env") for e in expand_locations(ctx, v, ctx.attr.srcs).split(" ")])
+ inputs = ctx.files.srcs
+
stamp = maybe_stamp(ctx)
if stamp:
- inputs = ctx.files.srcs + [stamp.volatile_status_file, stamp.stable_status_file]
- envs["BAZEL_STABLE_STATUS_FILE"] = stamp.stable_status_file.path
envs["BAZEL_VOLATILE_STATUS_FILE"] = stamp.volatile_status_file.path
- else:
- inputs = ctx.files.srcs
+ envs["BAZEL_STABLE_STATUS_FILE"] = stamp.stable_status_file.path
+ if not stamp.stamp_env_vars_only:
+ inputs = inputs + [stamp.stable_status_file, stamp.volatile_status_file]
ctx.actions.run(
outputs = outputs,
diff --git a/lib/stamping.bzl b/lib/stamping.bzl
index b54977d..33ae85f 100644
--- a/lib/stamping.bzl
+++ b/lib/stamping.bzl
@@ -103,6 +103,7 @@
return struct(
volatile_status_file = ctx.version_file,
stable_status_file = ctx.info_file,
+ stamp_env_vars_only = ctx.attr.stamp_env_vars_only,
)
return None
@@ -126,6 +127,7 @@
default = -1,
values = [1, 0, -1],
),
+ "stamp_env_vars_only": attr.bool(),
"_stamp_flag": attr.label(
doc = "Internal use only. A setting used to determine whether or not the `--stamp` flag is enabled.",
default = Label("//lib:stamp"),