-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(build): Support compiling well-known protobuf types #522
Conversation
Caveats:
|
Added a test of using Note: I had to modify some of the well-known protos to add doctest |
With prost releasing a new version supporting |
No, because I do not believe prost-types will be compiled with the Moreover, you can see the updated version of Note that the Also, I submit that the fact that my ultimate purpose is to gain access to |
Okay, that is fair, I need to think about this a bit more but I'd like to first ship a new version of tonic ASAP that works with tokio 1.0 then I plan on working on some enhancements. Since I don't consider this a major blocker to that I would like to look at this once we get that version out. Hopefully that version will go out this week. I really appreciate the time you took to look into this :) |
I agree, this PR is not a major blocker. |
Just wanted to provide a gentle nudge now that v0.4 is out. I'd love to get some feedback on this PR to keep it moving. My main question is how to thread through the |
FYI instead of copying the full proto definitions, it is sufficient to create a dummy proto file imports them from the environment
|
98d2077
to
dccf557
Compare
I removed the vendored proto files as suggested, and then rebased (with some churn for some typos of mine). Thoughts on whether a context structure makes sense? With three parameters now in some of the generation methods (e.g., |
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'm not super familiar with the code but the changes look pretty simple. Sounds like a useful feature to have as well.
The final 👍 should probably come from @LucioFranco though 😊
Apologies for the drive by comment, but I believe this functionality was already supported with Builder::compile_with_config. That's what we used to handle more specific configurations. Here is an example of how we used compile_with_config to specify this. |
So how did you work-around #521 then? Or was there another solution? |
Thanks for pointing that out. I needed to look more closely. Where things differed is I was specifying the well known types in a different crate and then pulling them into the current crate using extern_path. That doesn't appear to run into the same issue. |
Motivation
Tonic does not currently handle the case when Prost is configured to compile well-known protobuf types instead of just referencing
prost_types
. See #521 for a full description of the problem.Solution
Allow the user to configure Tonic to compile well-known protobuf types. That configuration is passed through to Prost.