Mark extension as reproducible (#92)

* Mark extension as reproducible

* Fix workspace setup
This commit is contained in:
Fabian Meumertzheim 2024-05-16 16:37:16 +02:00 committed by GitHub
parent 05ec3a3df2
commit 1b0d452dcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -56,9 +56,18 @@ list of strings, each of which is a label to a <code>constraint_value</code>
for the host platform.""",
)
def _host_platform_impl(_mctx):
def _host_platform_impl(module_ctx):
host_platform_repo(name = "host_platform")
# module_ctx.extension_metadata has the paramater `reproducible` as of Bazel 7.1.0. We can't
# test for it directly and would ideally use bazel_features to check for it, but adding a
# dependency on it would require complicating the WORKSPACE setup. Thus, test for it by
# checking the availability of another feature introduced in 7.1.0.
if hasattr(module_ctx, "extension_metadata") and hasattr(module_ctx, "watch"):
return module_ctx.extension_metadata(reproducible = True)
else:
return None
host_platform = module_extension(
implementation = _host_platform_impl,
doc = """Generates a <code>host_platform_repo</code> repo named