-
Notifications
You must be signed in to change notification settings - Fork 504
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: Extract file descriptor loading from compile_protos() #1067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see a test that actually uses this. Maybe you could edit an existing test to do some introspection?
prost-build/src/config.rs
Outdated
/// let mut config = Config::new(); | ||
/// let file_descriptor_set = config.load_fds(&["src/frontend.proto", "src/backend.proto"], &["src"])?; | ||
/// | ||
/// // Inspect file_descriptor_set and tweak config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to a concrete example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in cbf0813.
Co-authored-by: Casper Meijn <casper@meijn.net>
@caspermeijn Thanks for the review. I've added a usage example in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution
Thanks @caspermeijn! What is the next step for this PR to be merged? |
There you go |
Extracts the file descriptor loading part from
prost_build::compile_protos()
to a newprost_build::load_fds()
function.This allows inspection or even modification of descriptors before calling
prost_build::compile_fds
. Possible use cases include generating additional files from the descriptors, or set computedConfig
attributes by introspecting what is actually present in the.proto
files before generating the code.