rules_proto_grpc icon indicating copy to clipboard operation
rules_proto_grpc copied to clipboard

Add Rust Tonic and Prost support

Open aaliddell opened this issue 4 years ago • 6 comments

Either as additional rules or to replace the current rules as breaking change. These are better supported than the current grpcio etc crates and avoid the flakeyness of the current grpc-sys workarounds.

To do this requires that they have protoc plugins, which neither currently have since they share the same builder core. Currently blocked on:

  • https://github.com/tokio-rs/prost/issues/330 / https://github.com/tokio-rs/prost/issues/463 / https://github.com/tokio-rs/prost/pull/492
  • https://github.com/hyperium/tonic/issues/750

aaliddell avatar Sep 17 '21 20:09 aaliddell

I'm interested in implementing this. I think it would make sense to remove the existing rules and replace them with new rules (that have tonic and prost in the rule names in case other libraries become popular in the future).

titanous avatar Jun 10 '22 17:06 titanous

Do the upstream libraries actually have working protoc plugins yet? There seem to be some external ones, but are these official?

aaliddell avatar Jun 10 '22 17:06 aaliddell

They aren't official but they seem to work fine.

titanous avatar Jun 10 '22 17:06 titanous

https://github.com/bazelbuild/rules_rust/issues/915#issuecomment-1079742714 may be useful here.

UebelAndre avatar Jun 10 '22 17:06 UebelAndre

I've made good progress implementing this, but I've run into an issue where the tonic (gRPC) plugin wants to write to the output files from the prost plugin, and I can't see an existing way to make this happen in compile.bzl. Suggestions?

titanous avatar Jun 14 '22 20:06 titanous

I've implemented this in #202.

titanous avatar Jun 15 '22 23:06 titanous

Closed by #265

aaliddell avatar Sep 08 '23 11:09 aaliddell