From ba242e9751b9e65a09e10a2f64267af7dc33bdcc Mon Sep 17 00:00:00 2001 From: ksss Date: Tue, 6 Oct 2026 10:32:23 +0900 Subject: [PATCH] Rerun ruby-rbs-sys build script when C sources change 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 --- rust/ruby-rbs-sys/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/ruby-rbs-sys/build.rs b/rust/ruby-rbs-sys/build.rs index f382a3dcaa..afee471fb8 100644 --- a/rust/ruby-rbs-sys/build.rs +++ b/rust/ruby-rbs-sys/build.rs @@ -20,6 +20,12 @@ fn main() -> Result<(), Box> { } fn build(include_dir: &Path, src_dir: &Path) -> Result<(), Box> { + // bindgen's CargoCallbacks emits rerun-if-changed for headers only, which disables + // cargo's default "watch every package file" behavior. Watch the C sources and + // headers explicitly so edits to them trigger a rebuild. + println!("cargo:rerun-if-changed={}", src_dir.display()); + println!("cargo:rerun-if-changed={}", include_dir.display()); + let mut build = cc::Build::new(); build.include(include_dir);