Provide a way to run build.rs and then cancel the build because it decides nothing has changed #5663
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`
There is the
rerun-if-changed
andrerun-if-env-changed
which are very useful to avoid needless reruns. However, I'd like to rerun when there has been a new commit, because I'm usingbuild.rs
to embed the commit hash and title into the binary.build.rs
can't find this out using just filesystem and environment variable monitoring. Currently I passcargo:rerun-if-changed=.git
, but it's prone to false positives, because any git operation will trigger rerun.It would be useful if
build.rs
could be built and run, but it could then decide by itself whether anything has changed or not. Then I could check the latest git commit insidebuild.rs
and act according to that. There is surely other cases too where "env var changed" and "file modified" don't cut it as the only rerun triggers; one might want to check if the contents of a file changed, or do some further processing, like parse a file and check if a specific field changed.The text was updated successfully, but these errors were encountered: