Skip to content

Commit 97177fb

Browse files
fmeumrules_java Copybara
authored andcommitted
Mark compatibility_proxy extension as reproducible
Copybara Import from #259 BEGIN_PUBLIC Mark `compatibility_proxy` extension as reproducible (#259) This avoids an unnecessary lockfile entry. Closes #259 END_PUBLIC COPYBARA_INTEGRATE_REVIEW=#259 from fmeum:patch-2 3ce5497 PiperOrigin-RevId: 712925704 Change-Id: Ica006fc3942c32d8b21260e52ce251e24980001a
1 parent 767e441 commit 97177fb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

java/rules_java_deps.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,18 @@ _compatibility_proxy_repo_rule = repository_rule(
113113
def compatibility_proxy_repo():
114114
maybe(_compatibility_proxy_repo_rule, name = "compatibility_proxy")
115115

116-
def _compat_proxy_impl(_unused):
116+
def _compat_proxy_impl(module_ctx):
117117
compatibility_proxy_repo()
118118

119+
# module_ctx.extension_metadata has the paramater `reproducible` as of Bazel 7.1.0. We can't
120+
# test for it directly and would ideally use bazel_features to check for it, but don't want
121+
# to add a dependency for as long as WORKSPACE is still around. Thus, test for it by
122+
# checking the availability of another feature introduced in 7.1.0.
123+
if hasattr(module_ctx, "watch"):
124+
return module_ctx.extension_metadata(reproducible = True)
125+
else:
126+
return None
127+
119128
compatibility_proxy = module_extension(_compat_proxy_impl)
120129

121130
def protobuf_repo():

0 commit comments

Comments
 (0)