rust: replace bash script with build script#347
Conversation
|
LGTM PTAL @BusyJay |
|
Another thought: it may be bad to modify the source directory. It's more natural to generate sources into the target build directory and link it into source directory. For example, for now whenever do a |
@BusyJay agree. I address this in #349 by making code generation opt-in, so a regular |
|
|
|
Awesome start @nrc. |
I don't think we have to do this - we could copy the files from the OUT_DIR to the src directory rather than use |
|
I'm not familiar with how cargo compile dependencies. If I compile several projects in parallel, which all depend on kvproto, will kvproto also be compiled in parallel? So will the source files get written concurrently? Is it a race condition that can lead to corrupted files? |
Do you mean to debug it in the dependent project or inside kvproto? If debugging in dependent project, it may be easier to look at when the code is under target directory instead of $HOME/.cargo. |
It will be rebuilt for each project in the project's target directory - compiled code is not shared between projects, although there is work in the pipeline to do so
Both. And actually just writing code as a downstream user - it is nice to look on GitHub and see the generated code. |
What I mean is the generated code, as they are flushed into the source directory. |
Oh I see, if there are several projects using kvptoto via a In any case #349 changes things to opt-in regeneration so it will not be an issue. If you like we can close this PR and discuss #349, but I thought it would be easier to land one piece at a time. |
|
OK, I will give my approval when |
Makes generating Rust code easier and should help with the Prost migration
The changes are due to: * change in version of rust-protobuf * non-determinism in file generation (stepancheg/rust-protobuf#256) * formatting
|
@BusyJay comment addressed and rebased PTAL |
* Replace generate_rust with build script Makes generating Rust code easier and should help with the Prost migration * Commit generated files The changes are due to: * change in version of rust-protobuf * non-determinism in file generation (stepancheg/rust-protobuf#256) * formatting * rust: sort module names
With this change, preparing the Rust code becomes the idiomatic
cargo build, rather than requiring a script. We would like to migrate from rust-protobuf to Prost, and this change should make that easier.The Cargo build script is pretty much a 1:1 re-implementation of the old script.
cc @ice1000