Open
Description
Describe the problem you are trying to solve
When having entire autogenerated crates (eg https://github.com/dropbox/pb-jelly) - there isn't a good way to generate the crate at build time via build.rs.
Eg when building https://github.com/dropbox/pb-jelly/blob/a0c0550/examples/Cargo.toml, we get
nipunn-mbp:examples nipunn$ cargo build
error: failed to read `/Users/nipunn/src/pb-jelly/pb-test/gen/pb-jelly/proto_pbtest/Cargo.toml`
Caused by:
No such file or directory (os error 2)
This is because proto_pbtest
is generated in the build phase.
Current workarounds include
- commenting out the proto_pbtest dependency, building, uncommenting, building again
- Creating a dummy empty proto_pbtest Cargo.toml to be overwritten
- Splitting the build phase out into a separate crate
Describe the solution you'd like
Idea 1
- Parse the Cargo.toml - tolerating missing path dependencies
- Build the build.rs - only looking at build dependencies - ensuring they're all available
- Run build.rs
- Re-evaluate cargo task graph to search for the missing dependencies
- Run rest of the build
Idea 2
- Provide a command (eg cargo build --prebuild-only) to only run the build.rs build phase tolerating missing path dependencies in the other phases
- Developer can run
cargo build --prebuild-only
followed bycargo build
for projects like this
One idea, may be to
Idea 3 [hacky workaround]
- Provide a mode to tolerate missing path dependencies
cargo build --tolerate-missing-path-deps
- Developer can run
cargo build ; cargo build
Notes