Build script that compiles a crate: Re-run if its local "path dependencies" have changed #8091
Labels
A-build-scripts
Area: build.rs scripts
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Describe the problem you are trying to solve
I'm writing a library that contains several smaller crates, compiles them to Wasm, and exports those Wasm blobs as constants.
In order to be able to export them as constants, I'm using a
build.rs
to compile them usingcargo
. It looks something like this:Unfortunately, this breaks down when
foo
has local "path dependencies" that it needs to keep up-to-date with: Since thebuild.rs
is only re-run if files in its parent directory change, I can arrive at confusing situations where I've changedfoo
's dependency and I've changed my test to account for the new behavior, butfoo
doesn't actually update because nothing in the relevant directory has changed.Describe the solution you'd like
I would like to be able to express to Cargo that my build script compiles a crate, and should be re-run whenever that crate's source changes or whenever one of it's dependencies would no longer be valid to use (i.e. a yanked crate or a change path dependency)
Notes
In the meantime, my solution is to emit
cargo:rerun-if-changed=A file name that I know won't exist
. This has the behavior of re-running my build script upon every single build of my library, which probably isn't ideal.The text was updated successfully, but these errors were encountered: