SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 2 C++

feat(bazel): wire up prebuilt protoc toolchain (#24115)

Upstreamed from my https://github.com/aspect-build/toolchains_protoc which provided this feature outside the protobuf repo.

Adds:
- private API: module_extension + tag `protoc.prebuilt_toolchain` to provide and register toolchain for bzlmod users
- WORKSPACE users can live with the inconvenience of having to create toolchains themselves
- example of proto_library rule with intentionally non-functional cc toolchain, exercising the feature

This needs work with @thesayyn to:
- constrain users to choosing a protoc version agreeing with design doc
https://docs.google.com/document/d/16N-eU-0zHbWmxEuaUAIFTJwQLekIXZ8zIC3K4XDr20E/edit
- also register lang toolchains when the flag is enabled

Work towards #19558

Closes #24115

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/24115 from protocolbuffers:alexeagle/use_prebuilt_toolchain b18667d82c15cd2d69ba7846b29d0ded423bfca1
PiperOrigin-RevId: 844859103
A
Alex Eagle committed
cc23698b486e690ea2eb873cc7596a87c74a3ba6
Parent: 68346ec
Committed by Copybara-Service <copybara-worker@google.com> on 12/15/2025, 7:43:45 PM