Skip to content

Commit e5efde0

Browse files
authored
build: fix rebuild rules for no prebuilt bindings
only emit rerun-if-changed=bindings to the target-specific file when it is being used (fix #449) Signed-off-by: Eran Rundstein <[email protected]>
1 parent 2d0fe3c commit e5efde0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

grpc-sys/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,13 @@ fn bindgen_grpc(mut config: bindgen::Builder, file_path: &PathBuf) {
333333
fn config_binding_path(config: bindgen::Builder) {
334334
let file_path: PathBuf;
335335
let target = env::var("TARGET").unwrap();
336-
println!("cargo:rerun-if-changed=bindings/{}-bindings.rs", &target);
337336
match target.as_str() {
338337
"x86_64-unknown-linux-gnu" | "aarch64-unknown-linux-gnu" => {
338+
// Cargo treats nonexistent files changed, so we only emit the rerun-if-changed
339+
// directive when we expect the target-specific pre-generated binding file to be
340+
// present.
341+
println!("cargo:rerun-if-changed=bindings/{}-bindings.rs", &target);
342+
339343
file_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
340344
.join("bindings")
341345
.join(format!("{}-bindings.rs", &target));

0 commit comments

Comments
 (0)