From a3336baad163068b98c74aeac31bdd78415166b3 Mon Sep 17 00:00:00 2001 From: James Baker Date: Sat, 5 Aug 2023 15:51:34 +0100 Subject: [PATCH] rust bindings: Do not unnecessarily re-run build.rs 'cargo:rerun-if-changed' declarations tell Cargo when to re-run the build script. The intention is that if the build script depends on other files, then Cargo knows to re-run if those files change. It stores the output and checks it before each build. This rerun-if-changed declaration is a declaration on the _output_ of the build, and stores the absolute path of the output. This is not a useful declaration because the output path is unique to the build script - there is no way for anything else to change it. However, this does generate unnecessary rebuilds in some cases, for example if the dependent repository is moved in the filesystem. --- rust/onnxruntime-sys/build.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust/onnxruntime-sys/build.rs b/rust/onnxruntime-sys/build.rs index 82d1e4278015c..f59ee99fa29a7 100644 --- a/rust/onnxruntime-sys/build.rs +++ b/rust/onnxruntime-sys/build.rs @@ -105,7 +105,6 @@ fn generate_bindings(include_dir: &Path) { .expect("Unable to generate bindings"); let generated_file = PathBuf::from(env::var("OUT_DIR").unwrap()).join("bindings.rs"); - println!("cargo:rerun-if-changed={:?}", generated_file); bindings .write_to_file(&generated_file) .expect("Couldn't write bindings!");