From bde91ba5dd46799c5c049cc0befa674288b0c378 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Wed, 8 Jul 2026 20:07:03 -0400 Subject: [PATCH] Mark remote JDK toolchain config repositories reproducible Return repository metadata from _toolchain_config_impl so the generated remote JDK toolchain config repositories can use the repository contents cache. Guard repo_metadata for Bazel 7 and Bazel 8 compatibility. --- toolchains/remote_java_repository.bzl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toolchains/remote_java_repository.bzl b/toolchains/remote_java_repository.bzl index 65bbe482..f2ff953f 100644 --- a/toolchains/remote_java_repository.bzl +++ b/toolchains/remote_java_repository.bzl @@ -24,6 +24,10 @@ def _toolchain_config_impl(ctx): ctx.file("WORKSPACE", "workspace(name = \"{name}\")\n".format(name = ctx.name)) ctx.file("BUILD.bazel", ctx.attr.build_file) + # rules_java supports Bazel versions without repository_ctx.repo_metadata. + if hasattr(ctx, "repo_metadata"): + return ctx.repo_metadata(reproducible = True) + _toolchain_config = repository_rule( local = True, implementation = _toolchain_config_impl,