-
Notifications
You must be signed in to change notification settings - Fork 526
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: protoc path at runtime #282
Comments
@oll3 |
Yes, but prost-build uses this variable at build time... Usage of the tool looks something like: gen-crate --crate-name my-protocol-crate --proto-root-tree some/dir Where the directory given is scanned recursively to build a module tree from all packages found, and a Cargo.toml, a source tree of generated protobuf/gRPC files and a lib.rs which list all modules is spitted out. The problem is that at this time, when the cli tool executes, prost-build has already decided to use whatever path the cli tool had to protoc when the tool was compiled . Everything works fine if the tool is built and executed on the same host, but if we build the tool and executes it on another host where protoc is in a different location it won't be found. Do you understand my case? :) I can see that this might be outside the scope of Prost usage but wanted to ask anyway if this could be something supported. |
I see. That sounds more like the way a traditional |
Yes, exactly. The copy workaround is what I consider at the moment, but feels quite ugly. |
Yes, I was actually surprised to see that setting |
This seems to work ok, at least as long as I also set the include directory to a directory that exists on the target. |
For what it's worth, put together a plugin in #313, but ran into a similar issue with the need for protoc needing to be set in PROTOC and exist at build time. |
Is this still an issue with prost 0.7 and #283? |
Seems to be fixed @danburkert , thanks! |
We've built a small tool for pre-generating a Rust crate from a tree of protobuf files. Instead of generating the protobuf/gRPC code at build time of a project that project adds a dependency of the pre-generated protocol crate which may contain code for a number of protobuf/gRPC API's. This to simplify the process of creating a new project and speed up the build time.
However I noticed that when our tool is being built on another host than were it's later executed (to do the actual generation of the crate) then the path to
protoc
may no longer be valid. Depending on the environment where the tool is builtprost-build
will either try run one of the bundledprotoc
, but which are no longer bundled or aprotoc
selected by build time environment$PROTOC
.Could one introduce something like an env var at build time to tell Prost to use
protoc
available in the runtimePATH
instead of using the baked in path?The text was updated successfully, but these errors were encountered: