-
-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support --incompatible_enable_proto_toolchain_resolution #3895
Comments
I am a huge fan of this and will try to work on it in early April unless someone gets to it earlier. Cc @linzhp |
Enables use of `--incompatible_enable_proto_toolchain_resolution` flag that launched in Bazel 7. This allows users to choose a pre-built `protoc` or use the runtime from https://pypi.org/project/protobuf/ rather than be forced to use hard-coded values in Bazel core. This change is also happening in other language rulesets that provide first-class protobuf support, e.g. bazel-contrib/rules_go#3895 No update to CHANGELOG.md in this PR as the feature is not yet documented for end-users, this just makes it possible to enable the flag. A follow-up PR will provide user instructions. --------- Co-authored-by: Alex Eagle <alex@aspect.dev>
@thesayyn I tried using rules_java with |
Toolchain for java comes from protobuf repo, that's only one we i know of unless @alexeagle added one in his prebuilt toolchains ruleset. |
Right, the flag decouples from the hardcoded toolchain but doesn't automatically supply a replacement. It should be easy to fetch the runtime from Maven exactly like the protobuf docs instruct all non-Bazel users/tools should do. I'll add to the toolchains_protoc |
correction, https://github.com/bazelbuild/examples/blob/never_compile_protoc_again/proto/java/Main.java already shows how this works for Java. |
Is there an example of using this with |
You don't need to do anything extra for |
Adding the example here: aspect-build/toolchains_protoc#10 |
What version of rules_go are you using?
Current
What version of Bazel are you using?
7.0.0 or later
What did you do?
Try to build a
go_library
target with the flag enabled and a different toolchain registered for@rules_proto//proto:toolchain_type
What did you expect to see?
When
--incompatible_enable_proto_toolchain_resolution
is enabled, rules should consult the relevant toolchain_type to locate protoc.Example PR from rules_python:
bazelbuild/rules_python#1577
That means I ought to be able to add a Go example to https://github.com/alexeagle/toolchains_protoc/tree/main/examples
which is a project that ensures we never have to build the
cc_binary
target for protoc from sources.What did you see instead?
https://github.com/bazelbuild/rules_go/blob/cac338e5c869116cbe86758001dced886a38b39c/proto/BUILD.bazel#L129 depends on
@com_google_protobuf//:protoc
directly.In this case I registered a pre-built protoc toolchain (using https://github.com/alexeagle/toolchains_protoc) but get an error:
The text was updated successfully, but these errors were encountered: