Skip to content

Commit 9a1e906

Browse files
authored
Add rerun-if-changed to libgit2-sys build script. (#640)
1 parent 0313adc commit 9a1e906

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libgit2-sys/build.rs

+14
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ fn main() {
182182
println!("cargo:rustc-link-lib=framework=Security");
183183
println!("cargo:rustc-link-lib=framework=CoreFoundation");
184184
}
185+
186+
rerun_if(Path::new("libgit2/include"));
187+
rerun_if(Path::new("libgit2/src"));
188+
rerun_if(Path::new("libgit2/deps"));
185189
}
186190

187191
fn cp_r(from: impl AsRef<Path>, to: impl AsRef<Path>) {
@@ -214,3 +218,13 @@ fn add_c_files(build: &mut cc::Build, path: impl AsRef<Path>) {
214218
}
215219
}
216220
}
221+
222+
fn rerun_if(path: &Path) {
223+
if path.is_dir() {
224+
for entry in fs::read_dir(path).expect("read_dir") {
225+
rerun_if(&entry.expect("entry").path());
226+
}
227+
} else {
228+
println!("cargo:rerun-if-changed={}", path.display());
229+
}
230+
}

0 commit comments

Comments
 (0)