Repository navigation
Conversation
bindgen's `CargoCallbacks` emits `rerun-if-changed` for headers only. Emitting even one such line disables cargo's default of watching every file in the package, so edits to `src/*.c` no longer re-ran the build script and `rust/` tests passed against stale objects. Emit `rerun-if-changed` for the C source and include directories explicitly. Cargo walks directories recursively by mtime. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rust/ruby-rbs-sys/build.rsis not re-run whensrc/*.cchanges. Aftertouch src/string.c,cargo build -vprintsFresh ruby-rbs-sysand the C code is not rebuilt.bindgen's
CargoCallbacksemitscargo:rerun-if-changedfor headers only. Emitting even one such line disables cargo's default of watching every file in the package, sosrc/*.cdrops out of the watch list.Impact
Users installing from crates.io are not affected (the vendored files are real files). Developers who edit C inside this repository and run the
rust/tests are: they get green results against stale objects.Fix
Emit
cargo:rerun-if-changedfor the C source directory and the include directory inbuild(). Cargo walks a directory recursively by mtime, including through thevendor/rbs/{src,include}symlinks.Verification
With
cargo build -v -p ruby-rbs-sys:touch src/string.c→ stillFresh ruby-rbs-sysFreshtouch src/string.c→Dirty ... vendor/rbs/src has changed, recompiledtouch include/rbs/string.h→Dirty ... vendor/rbs/include has changed, recompiled🤖 Generated with Claude Code