Skip to content

Commit 1b0d452

Browse files
authored
Mark extension as reproducible (#92)
* Mark extension as reproducible * Fix workspace setup
1 parent 05ec3a3 commit 1b0d452

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

host/extension.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,18 @@ list of strings, each of which is a label to a <code>constraint_value</code>
5656
for the host platform.""",
5757
)
5858

59-
def _host_platform_impl(_mctx):
59+
def _host_platform_impl(module_ctx):
6060
host_platform_repo(name = "host_platform")
6161

62+
# module_ctx.extension_metadata has the paramater `reproducible` as of Bazel 7.1.0. We can't
63+
# test for it directly and would ideally use bazel_features to check for it, but adding a
64+
# dependency on it would require complicating the WORKSPACE setup. Thus, test for it by
65+
# checking the availability of another feature introduced in 7.1.0.
66+
if hasattr(module_ctx, "extension_metadata") and hasattr(module_ctx, "watch"):
67+
return module_ctx.extension_metadata(reproducible = True)
68+
else:
69+
return None
70+
6271
host_platform = module_extension(
6372
implementation = _host_platform_impl,
6473
doc = """Generates a <code>host_platform_repo</code> repo named

0 commit comments

Comments
 (0)