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

prost_build::Config::file_descriptor_set_path #409

Merged
merged 2 commits into from
Dec 27, 2020

Conversation

danburkert
Copy link
Collaborator

This is spiritually the same as #326 (and includes the commits from that branch), but changes the API/implementation to be a bit more flexible and simpler, respectively. The file_descriptor_set_path takes a path argument which is passed directly to protoc. The upside is that crates which call prost_build multiple times can have separate paths, and prost is no longer involved in parsing/re-serializing the file descriptor set, which could have subtle implications. The downside is that the API is a bit more cumbersome, but the addition of an example should offset this.

This commit adds support for writing an encoded version of the
appropriate FileDescriptorSet to a file named `file_descriptor_set.bin`
in the output directory. This can be used with the `include_bytes` macro
by consuming applications or libraries.

The rationale for this pull request is to support the gRPC Server
Reflection Protocol, which operates in terms of FileDescriptorProto, in
Tonic. FileDescriptorProto instances are contained inside a
FileDescriptorSet.
@danburkert danburkert force-pushed the file-descriptor-set-dcb branch from ac04240 to f90f2d1 Compare December 27, 2020 16:04
This tweaks the file descriptor set option to take a path argument
instead of a fixed path. This allows it to work with crates who invoke
`prost-build` multiple times.  It also saves `prost-build` from having
to read and re-encode the file descriptor set, which could have subtle
effects on it.
@danburkert danburkert force-pushed the file-descriptor-set-dcb branch from f90f2d1 to 93a35cb Compare December 27, 2020 16:05
@danburkert danburkert merged commit 6a4f12a into master Dec 27, 2020
@danburkert danburkert deleted the file-descriptor-set-dcb branch December 27, 2020 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants