Skip to content
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

Fix incorrect rerun-if-changed triggering needless rebuilds #115

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

rukai
Copy link
Contributor

@rukai rukai commented May 26, 2024

The current build.rs has a bug where the build.rs will always be rerun on the second build of the project.
This looks like:

> rm -r target
> cargo build
  all dependencies and crate is built, build.rs is run for the first time.
> cargo build
  build.rs is rerun, causing crate to go through compilation.
> cargo build
  compilation is skipped entirely since build.rs does not run.

This issue is particularly bad for CI systems that cache a single build of the main branch, and then use that cache for testing incoming PRs, since every build is effectively a second build. This means that even PRs that dont touch the crate have to wait for the crate binary to recompile.

The issue is that a cargo:rerun-if-changed= is set for an output file of the build.rs.
cargo:rerun-if-changed= should only be used for inputs, otherwise we will hit issues like this.

This PR fixes the issue by removing the problem rerun lines.
This will not regress any functionality since we will still rerun when the rust/jassets/j4rs*.jar changes.
This additionally let us remove the glob dependency from build.rs since its no longer needed.

@astonbitecode astonbitecode merged commit 3f30aa9 into astonbitecode:master Jun 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants