Repository navigation
Let builds choose where gen-compile-cache runs - #8969
Conversation
52d7529 to
de67e0f
Compare
gen-compile-cache is built for the target platform, since only the target's V8 accepts the caches it writes. In a cross-compiling build the execution platform Bazel picks for it may not be able to run it, and the only way to change that was to run it locally. The compile cache rule now takes an optional toolchain of a new type, compile_cache_executor_toolchain_type. None is registered by default, so nothing changes unless a build registers one, whose exec_compatible_with then picks the execution platform the tool runs on, such as one with the target's CPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
de67e0f to
1f6d6e7
Compare
There was a problem hiding this comment.
✅ Approved — This is a small, opt-in Bazel hook. Nothing changes for existing builds, and no issues were found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
No security concerns. The change touches only Bazel toolchain resolution for a build action.
📋 Code Quality: ✅ LGTM
The optional toolchain (mandatory = False) affects only how Bazel picks the execution platform for _gen_compile_cache. With no toolchain of this type registered, the choice is the same as before. cfg = "target" and run_shell are unchanged, so V8 is still built only once.
📝 Documentation: ✅ LGTM
The comment on the new toolchain_type explains why the hook exists, what happens by default, and how a build registers a toolchain for it, using @bazel_tools//tools/test:empty_toolchain constrained to the target's CPU as the example.
Reviewed commit: 1f6d6e78
gen-compile-cache is built for the target platform (
cfg = "target"), since only the target's V8 accepts the caches it writes. In a cross-compiling build, the execution platform Bazel picks for it may not be able to run it, and the only way around that was to run it locally.This gives the compile cache rule an optional toolchain of a new type,
//build/config:compile_cache_executor_toolchain_type. None is registered by default, so nothing changes for existing builds. A build that has an execution platform able to run the tool can register a toolchain of this type, for example@bazel_tools//tools/test:empty_toolchainwithexec_compatible_withandtarget_compatible_withset to the target's CPU. The compile cache actions then run on that platform, and everything else stays on the platform Bazel would have picked anyway.A toolchain is the hook because
exec_compatible_withcan't be configured withselect(), and a target's exec properties can only pick between executors of a platform it already runs on.🤖 Generated with Claude Code