feat(bazel): wire up prebuilt protoc toolchain
Upstreamed from my https://github.com/aspect-build/toolchains_protoc which provided this feature outside the protobuf repo.
Adds:
- private API: repository rule
prebuilt_protoc_repoto fetch a protoc binary from GitHub releases - public API: repository rule
prebuilt_toolchains_repothat creates the "hub" letting Bazel's toolchain resolver download only for the execution platform - public API: module_extension + tag
protoc.prebuilt_toolchainto wrap up the above for bzlmod users - WORKSPACE users can live with the inconvenience of having to create toolchains themselve
- 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
This looks reasonable to me. But it's still missing the validation layer AFAICT. Is this PR waiting for that? Also the tests are all still broken
Sure, I can pick up something like https://github.com/protocolbuffers/protobuf/pull/23539 - the only comment I got there was "cannot reproduce" but I'd like to know if the guarantee is strong enough.
Separately I'd be very happy to land this one first. That could unblock the flag flip in time for Bazel 9 due in a month.
Sure, I can pick up something like #23539 - the only comment I got there was "cannot reproduce" but I'd like to know if the guarantee is strong enough.
Separately I'd be very happy to land this one first. That could unblock the flag flip in time for Bazel 9 due in a month.
I'd probably like to see version check to prevent use of arbitrarily old versions of prebuilt protoc or newer versions of protoc from being used like w https://protobuf.dev/support/cross-version-runtime-guarantee/.
Sure, I can pick up something like #23539 - the only comment I got there was "cannot reproduce" but I'd like to know if the guarantee is strong enough.
Separately I'd be very happy to land this one first. That could unblock the flag flip in time for Bazel 9 due in a month.
+1 to Sandy, while we might be ok with landing this PR first, we definitely wouldn't want to flip the flag without the validation we laid out in the design.
I'm not sure what guarantee is in that prototype, but it does seem like an appropriate place to add the validation
okay @zhangskz I've added the version verification to this PR, PTAL