Skip to content
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

Document @com_google_protobuf//:protoc? #174

Closed
liningpan opened this issue Jun 11, 2023 · 2 comments
Closed

Document @com_google_protobuf//:protoc? #174

liningpan opened this issue Jun 11, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee)

Comments

@liningpan
Copy link

There are some rust protobuf/grpc libraries (e.g. prost, tonic) that use the protoc binary to compile .proto files into the descriptor set. Afterwards, these libraries use the descriptor set to generate rust code.

I found out that @com_google_protobuf//:protoc is a convenient way to get precompiled protoc (whenever possible). However, I can't find where this is documented or if this is something stable that we can rely on.

@comius comius added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) documentation Improvements or additions to documentation labels Aug 30, 2023
@comius
Copy link
Collaborator

comius commented Aug 30, 2023

Correct, @com_google_protobuf//:protoc handles precompiled protoc.

It's quite hacky, as it constructs a pre-bzlmod repository, which overwrites protoc published BUILD files with targets that select binaries. Implementation is in rules_proto and it's hard to follow.

The problem with it is, that the versions need to be updated on each protoc release in rules_proto repository (hence the 21.7 in the name of protoc release).

To fully support bzlmod we need another mechanism. This mechanism are toolchains, which make it possible to select binary if one is available on the platform (cpu/operating system) and fallback to sources if not.

When toolchains are implemented the hack will be removed from this repository.

@alexeagle
Copy link
Collaborator

I think we can close this as it will be resolved by #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
Projects
None yet
Development

No branches or pull requests

3 participants