Closed nathan-at-least closed 1 year ago
After more digging, I see prost_build::Config::compile_fds
and tonic_build::Builder::compile_with_config
so there's almost a connection.
However, it appears that tonic_build::Builder::compile_with_config
(line 534) delegates directly to prost_build::Config::compile_protos
. Since that is an alternate "entry point" vs compile_fds
I currently believe it's not possible to connect up protox
into the tonic_build
flow.
I'm going to go file a ticket with tonic_build
to highlight this issue.
I've not tried this with tonic_build
, but it should be possible to write the file descriptor set to a file, set file_descriptor_set_path()
to point at it, and then set skip_protoc_run
to bypass the normal protoc invocation
compile_fds
is much nicer though, I think tonic just hasn't got a wrapper for it yet since its a newer API.
Tangential question: I'm only familiar with the tonic
use case. What are use cases that rely directly on prost
?
My personal use-case is lanquetta, a tool for testing gRPC services. It uses tonic and prost but not tonic-build/prost-build (since all the protobuf definitions are loaded at runtime). The fact it can be used in build scripts is a nice bonus 😄
I'm somewhat familiar with using
tonic_build
as a black-box, and I'm looking for a way to avoid the non-rustprotoc
dependency.The only example I see here is integrating with
prost_build
but I haven't yet figured out the relationship betweentonic_build
andprost_build
.The only mention of
prost_types::FileDescriptorSet
I see in intonic_build
istonic_build::Builder::file_descriptor_set_path
and that reads to me like it causestonic_build
to generate theFileDescriptorSet
which seems like the same purpose ofprotox::compile
.How can I integrate
protox
andtonic_build
to enable a build free of non-rust dependencies fortonic
server/client?