rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Add support for prost-reflect to rust_prost_toolchain

Open robot-head opened this issue 6 months ago • 1 comments

I have a need to parse a bunch of textproto encoded files in a rust_binary target, with schemas defined in a proto_library.

To do this, I need to pull in prost-reflect as a dependency, but just as I needed to build a custom toolchain to unite prost and tonic, that rule apparently needs to include prost-reflect if desired for me to be able to do this.

Wondering if this would be possible to support.

Thanks

robot-head avatar Aug 24 '25 01:08 robot-head

When I did this I had to patch prost-build... https://github.com/DolceTriade/blade/blob/main/third_party/rust/patches/prost-build/0001-Allow-substitution-for-the-message-type-in-type-attr.patch

And then I configured my prost toolchain like so: https://github.com/DolceTriade/blade/blob/main/prost/BUILD.bazel#L22-L34

Then I could use DynamicMessage for protojson support: https://github.com/DolceTriade/blade/blob/938f5ef9a2eca868c4438792bd60040a8f90e436/blade/bep/print_event.rs#L23

DolceTriade avatar Sep 15 '25 00:09 DolceTriade