Function build::output::rerun_if_changed
source · [−]Expand description
The rerun-if-changed
instruction tells Cargo to re-run the build script
if the file at the given path has changed. Currently, Cargo only uses the
filesystem last-modified “mtime” timestamp to determine if the file has
changed. It compares against an internal cached timestamp of when the build
script last ran.
If the path points to a directory, it will scan the entire directory for any modifications.
If the build script inherently does not need to re-run under any
circumstance, then emitting cargo:rerun-if-changed=build.rs
is a simple
way to prevent it from being re-run (otherwise, the default if no
rerun-if
instructions are emitted is to scan the entire package
directory for changes). Cargo automatically handles whether or not the
script itself needs to be recompiled, and of course the script will be
re-run after it has been recompiled. Otherwise, specifying build.rs is
redundant and unnecessary.