-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rerun-if-changed on directory does not rerun on new timestamp or file contents #2599
Comments
This is not a regression (it never worked as described in the docs). Same pattern with cargo 0.9 and 0.10. |
For sanity: deleting both
|
Yeah this is actually intended behavior. Cargo does not traverse a directory and try to find changes inside, but rather it just looks at the mtime of the directory itself (which can vary depending on platform when it's updated). This was discussed in the original implementation and the special support for directories was explicitly removed. Thanks for the report though! |
Please reopen as docs bug, as this is not clear at all. |
So how do I say "please rerun the build script if files are created or deleted or changed within this dir"? Do I need to print a line for the directory itself and every file/directory within it? |
Ah yeah a docs bug is fine. And yeah, you'll need to print a line per file in the directory you care about. |
fix rerun-if-changed documentation The documentation corresponded to the initial proposed implementation, which was changed to remove special handling of directories before it was ever merged. closes #2599 r? @alexcrichton
Could |
Perhaps, yeah, but it's arguably much simpler to keep track of specific files (someone's gonna have to do it). |
Is there a way to add extra file detection, but overwrite the default? |
Note from the future: Cargo will rescan an entire directory recursively for changes, done in cee088b. |
I did
println!("cargo:rerun-if-changed=dir")
wheredir
is a directory in the same directory asCargo.toml
.I expected the build script to rerun if any file within
dir
changes its timestamp or contents. However, it only reruns if files are created or deleted.I have created a quick-and-dirty test script in this crate. This is the output:
cc @huonw
The text was updated successfully, but these errors were encountered: