-
Notifications
You must be signed in to change notification settings - Fork 1k
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
implement a protoc plugin #750
Comments
I'm not very familiar with how protoc actually works. I've only ever used it in directly through prost. So not sure what you mean by "protoc plugin". Regardless, this feels more like a prost issue than a tonic issue. Tonic doesn't actually do any protobuf compilation itself. For that it uses prost. And the rustfmt dependency can be disabled with the cargo feature: |
I was just going to create a request like this one! @davidpdrsn A protoc plugin is defined here: https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.plugin In short, a plugin is a binary which protoc can invoke when building proto files. The syntax is something like:
They often follow the convention There are plugins for many languages. For example:
Please note that these are not plugins to build proto files, but code generation tools. I may be wrong but this would be the equivalent of what The biggest difference is that by having a plugin:
|
We have a similar PR in prost to support this from the protobuf generation side tokio-rs/prost#492 |
just wanted to mention Tuetuopay/protoc-gen-tonic here as I came across the topic 😉 |
I guess this can be closed as a plugin was implemented and released: https://github.com/neoeinstein/protoc-gen-prost |
Feature Request
Would be very useful to be able to use tonic as a plugin for protoc. We are currently trying to coordinate our .proto files using a dedicated repo and use CI to generate the code. for our other languages we can use protoc (or actually buf/build which is a drop in replacement for protoc).
Having a protoc plugin would make it much easier to integrate tonic with other tooling.
I have made a naive attempt at creating a protoc-plugin by using
tonic_build
to generate files to a tmp directory and reading those.Althoug a bit clunky it worked, but i dont think its an ideal solution
I think tooling for generating and sharing protobuf/grpc implementations is getting more prevalent, so i think having a protoc-plugin would be valuable, and i would be happy to dig in and contribute to that, im curious if that is already somthing that is being considered and/or welcomed.
The text was updated successfully, but these errors were encountered: