Open malt3 opened 4 months ago
In theory, C++ doesn't have to be covered here because the official Protobuf documentation says that C++ developers ought to build it from source: https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation
If you author C++ code then it's reasonable to require every engineer on your team has a functioning local toolchain, or you've configured Bazel with a hermetic toolchain.
In practice of course it's ALWAYS annoying to compile protoc and watch its gcc warnings scrolling by, and I'd love to have C++ here too!
Tagging @thesayyn who might recall whether any work happened with cc_proto_library
to make this possible
Just to add a bit of context, it's entirely possible that you don't author any C++ code, but still need a C++ toolchain. In my case, the Python gRPC plugin is implemented in C++ and needs to generate C++ libraries for CodeGeneratorRequest
etc., so Python proto libraries compile quickly, but Python gRPC libraries do not.
@ouillie I had exactly that discussion with a team today, who wishes the scope of this repo included gRPC as well to avoid building those programs from source. Sadly that scope increase isn't funded here.
Ah. Well, I just forked gRPC and added a little script to upload pre-built plugin binaries for Linux / MacOS e.g. v1.67.1. It's a pretty small/easy script. I'll see if they're OK with taking it upstream.
Would you have any appetite for me to submit a PR to toolchains_protoc
to make use of them? Otherwise, it wouldn't be too hard for that team to make use of them anyway with an http_archive
and manually setting up the toolchain with a plugin.
Just thinking aloud, the Python gRPC plugin is also published as grpcio-tools, could this py_binary be used as a executable tool for the grpc plugin?
Update: Yes, seems like it can be used, see https://github.com/chrisirhc/precompiled-grpc-in-bazel-python . However, you'll be coupling your grpc version with the protoc plugin version brought in by the grpcio-tools.
What is the current behavior?
I can't quite get
cc_proto_library
to work and there is no end-to-end example for C++.Describe the feature
I'd like to enable
--incompatible_enable_proto_toolchain_resolution
and use a precompiled protoc. I got this mostly working:MODULE.bazel
:toolchain/BUILD
:BUILD
:foo.proto
:Output:
edit
I think the
runtime
attribute ofproto_lang_toolchain
should be something like@com_google_protobuf//:protoc_lib
. I’ll experiment some more.