Closed jrandolf closed 5 months ago
So after investigating things further, I was able to fix this using
protoc.toolchain(
name = "protoc_toolchains",
version = "v27.0-rc3",
)
use_repo(protoc, "protoc_toolchains")
which makes sense because protoc_toolchains
is a different repo that doesn't clash with the default one.
However, I find this counter intuitive to other stable toolchains such as rust and nodejs. I suggest we either remove the default one and enforce users to pick their own (which is almost always the way to do things to ensure there are no surprises with versioning) or we somehow remove/decouple the com_google_protobuf
attribute from the toolchain and require users to choose their protobuf type implementation (this is what's causing the clash in the repro).
Here is where the logic is intended to allow the root module to pick the version https://github.com/aspect-build/toolchains_protoc/blob/main/protoc/extensions.bzl#L18-L21
Let's start with an issue rather than a PR since we don't agree on what the problem is nor the expected behavior.
These cause errors when a user tries to declare their own toolchain using the default repository. For example: