Skip to content

Don't track bridge files in OUT_DIR#1668

Merged
dtolnay merged 1 commit intodtolnay:masterfrom
phil-opp:dont-track-out-dir
Nov 11, 2025
Merged

Don't track bridge files in OUT_DIR#1668
dtolnay merged 1 commit intodtolnay:masterfrom
phil-opp:dont-track-out-dir

Conversation

@phil-opp
Copy link
Copy Markdown
Contributor

Files in the OUT_DIR are likely generated by the very same build script. As such, they likely have a modification time that is after the build script's start time. This causes cargo to assume that the file has changed since the last run, thereby considering the build script dirty on every build. The result is that the build script and everything above in the dependency is recompiled on every build.

This commit avoids that problem by emitting the rerun-if-changed command only for files that are not in the OUT_DIR.

Proposed in #1462 (comment)

Files in the `OUT_DIR` are likely generated by the very same build script. As such, they likely have a modification time that is after the build script's start time. This causes cargo to assume that the file has changed since the last run, thereby considering the build script dirty on every build. The result is that the build script and everything above in the dependency is recompiled on every build.

This commit avoids that problem by emitting the `rerun-if-changed` command only for files that are not in the `OUT_DIR`.
Copy link
Copy Markdown
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay dtolnay merged commit b0549b9 into dtolnay:master Nov 11, 2025
29 checks passed
@phil-opp phil-opp deleted the dont-track-out-dir branch November 12, 2025 09:32
@phil-opp
Copy link
Copy Markdown
Contributor Author

Thanks for creating a new release!

phil-opp added a commit to dora-rs/dora that referenced this pull request Nov 12, 2025
phil-opp added a commit to dora-rs/dora that referenced this pull request Nov 12, 2025
- Update `cxx` crate to 1.0.188 to include
dtolnay/cxx#1668
- Remove `rerun-if-changed` for autogenerated file (which always caused
rebuild)
- Rerun build script if the `DORA_NODE_API_CXX_INSTALL` env variable
changes

Discovered in
#1182 (comment)
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