rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Support incompatible_enable_proto_toolchain_resolution

Open alexeagle opened this issue 2 months ago • 3 comments

Currently rules_rust requires the user to override the protoc compiler https://github.com/bazelbuild/rules_rust/blob/df7a6555de52d093183ba03694632fff400c106c/proto/protobuf/toolchain.bzl#L174 with a fixed label to replace it.

However Bazel 7 introduced --incompatible_enable_proto_toolchain_resolution and rules_proto 6.0 allows users to register a toolchain for protoc. The toolchain_type is @rules_proto//proto:toolchain_type: https://github.com/bazelbuild/rules_proto/blob/6.0.0-rc3/proto/BUILD#L57-L60

https://registry.bazel.build/modules/toolchains_protoc is a reference implementation and has examples

Similar change in other language rules:

  • python: https://github.com/bazelbuild/rules_python/pull/1577
  • go: https://github.com/bazelbuild/rules_go/issues/3895

alexeagle avatar Apr 23 '24 23:04 alexeagle