Skip to content

Mark remote JDK toolchain config repositories reproducible#365

Open
dzbarsky wants to merge 1 commit into
bazelbuild:masterfrom
dzbarsky:codex/reproducible-toolchain-config-repositories
Open

Mark remote JDK toolchain config repositories reproducible#365
dzbarsky wants to merge 1 commit into
bazelbuild:masterfrom
dzbarsky:codex/reproducible-toolchain-config-repositories

Conversation

@dzbarsky

@dzbarsky dzbarsky commented Jul 9, 2026

Copy link
Copy Markdown

The _toolchain_config repository rule creates the remote JDK *_toolchain_config_repo repositories from deterministic WORKSPACE and BUILD.bazel content. Return repo_metadata(reproducible = True) so Bazel can use the repository contents cache for these repositories, with a hasattr guard for Bazel versions that do not provide repository_ctx.repo_metadata.

Validation:

  • Bazel 9.1.1 query of all 200 targets in the 40 remote JDK toolchain config repositories
  • Bazel 7.6.1 query of @remotejdk21_macos_aarch64_toolchain_config_repo//:all
  • buildifier -mode=check toolchains/remote_java_repository.bzl

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.
@dzbarsky dzbarsky marked this pull request as ready for review July 9, 2026 00:13
@dzbarsky dzbarsky requested review from a team and hvadehra as code owners July 9, 2026 00:13
# rules_java supports Bazel versions without repository_ctx.repo_metadata.
if hasattr(ctx, "repo_metadata"):
return ctx.repo_metadata(reproducible = True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly return None here to make buildifier happy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants