Allow to use cargo changes tracking to avoid excessive runs of build.rs
kilork opened this issue · 6 comments
Example from typical build.rs
:
println!("cargo:rerun-if-changed=build.rs");
This allows to run build.rs
only if build.rs
changed. Similar we can add static files to list of changes. This needs to be tested for new files case also.
What's the current system to deal with this? It seems like I need to manually cargo clean at random intervals in order to avoid downright bizarre errors that ultimately seem to somehow be related to build.rs not running when it should. Ideally, in my project, it would just run every time that cargo run or cargo build is called.
@john01dav I usually move resources to separate crate and use some feature flag to exclude it from regular build while I am working on something other.
Also of course you can just write those instructions by hand after resource generation.
@john01dav I usually move resources to separate crate and use some feature flag to exclude it from regular build while I am working on something other.
Also of course you can just write those instructions by hand after resource generation.
I don't see how moving static file things to a separate crate fixes the issue where my underlying files change but build.rs does not rerun. In case it's relevant, since the files that actix-web-static-files packages are generated by npm, they are .gitignored, and this might interfere with the normal system.
Sorry, probably I got your question wrong. Then probably you can add those instructions by hand.
More info you can find here: https://doc.rust-lang.org/cargo/reference/build-scripts.html#change-detection
I have feeling this feature works strange, need to experiment more with that before I can really give a good advice here.
Created new crate to handle this: change-detection.
Need to think a little bit, how to integrate this with actix-web-static-files
.
Created one more crate to help: path-matchers