-
Notifications
You must be signed in to change notification settings - Fork 32
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
Automatically rebuild if Cargo.toml or git changes #19
Comments
Thanks for the report. That would mean we had to scan the git-root for all the files and cause cargo to fingerprint them?! |
Or just HEAD and whatever contains the tags. |
Note due to workspaces, this feature would need to also check the Cargo.toml at the root. But I guess it would be sufficient, and probably more desirable, to check if the And IIRC, |
Note according to https://doc.rust-lang.org/cargo/reference/build-scripts.html#change-detection , Emitting one of these replaces the default behaviour, which is to "always re-running the build script if any file within the package is changed". i.e. built emitting this can break existing code which relied on that default behaviour. |
The change needed to rerun if lockfile is modified is at jayvdb@c584bbd However I cant help but wonder if cargo already rebuilds built.rs on lock file changes. When I manually change Cargo.lock by removing the comment header at the top - i.e. not changing any lock entry, I see the following when using
|
I'm hesitant to implement this unless somebody comes up with a case which fits into the pattern mentioned below. As far as I can see:
The way I see this, since users have to have at least a one-line build script in place anyway, we're better off with a documentation fix on how users might want to emit |
Of all the things that are recorded by built, Cargo.toml and git can change without triggering a rebuild the next time
cargo build
is run. If those options are enabled, built should emitcargo:rerun-if-changed=<file>
for the Cargo.toml and any files in .git. That way cargo can automatically determine if the build.sh script needs to rerun or not.I ran into this issue trying to do a manual release (we're working on CI) of an internal project and had to manually change the build.rs file to get cargo to rerun built and get a new git hash.
The text was updated successfully, but these errors were encountered: