Skip to content

Commit 99b4b25

Browse files
authored
fix use of stamping in rust_binary_without_process_wrapper (#1218)
* don't ever stamp when building process_wrapper * buildify * fix `stamp = 0` for all rust_binary_without_process_wrapper
1 parent 8df4517 commit 99b4b25

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

rust/private/rust.bzl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,14 +929,27 @@ rust_binary = rule(
929929
"""),
930930
)
931931

932-
def _fake_out_process_wrapper(attrs):
932+
def _common_attrs_for_binary_without_process_wrapper(attrs):
933933
new_attr = dict(attrs.items())
934+
935+
# use a fake process wrapper
934936
new_attr["_process_wrapper"] = attr.label(
935937
default = None,
936938
executable = True,
937939
allow_single_file = True,
938940
cfg = "exec",
939941
)
942+
943+
# fix stamp = 0
944+
new_attr["stamp"] = attr.int(
945+
doc = dedent("""\
946+
Fix `stamp = 0` as stamping is not supported when building without process_wrapper:
947+
https://github.com/bazelbuild/rules_rust/blob/8df4517d370b0c543a01ba38b63e1d5a4104b035/rust/private/rustc.bzl#L955
948+
"""),
949+
default = 0,
950+
values = [0],
951+
)
952+
940953
return new_attr
941954

942955
# Provides an internal rust_binary to use that we can use to build the process
@@ -945,7 +958,7 @@ def _fake_out_process_wrapper(attrs):
945958
rust_binary_without_process_wrapper = rule(
946959
implementation = _rust_binary_impl,
947960
provides = _common_providers,
948-
attrs = dict(_fake_out_process_wrapper(_common_attrs).items() + _rust_binary_attrs.items()),
961+
attrs = dict(_common_attrs_for_binary_without_process_wrapper(_common_attrs).items() + _rust_binary_attrs.items()),
949962
executable = True,
950963
fragments = ["cpp"],
951964
host_fragments = ["cpp"],

0 commit comments

Comments
 (0)