Skip to content

Commit

Permalink
only emit rerun-if-changed=bindings to the target-specific file when …
Browse files Browse the repository at this point in the history
…it is being used (fix tikv#449)

Signed-off-by: Eran Rundstein <[email protected]>
  • Loading branch information
eranrund committed Mar 26, 2020
1 parent 2d0fe3c commit 1e9392f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grpc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,13 @@ fn bindgen_grpc(mut config: bindgen::Builder, file_path: &PathBuf) {
fn config_binding_path(config: bindgen::Builder) {
let file_path: PathBuf;
let target = env::var("TARGET").unwrap();
println!("cargo:rerun-if-changed=bindings/{}-bindings.rs", &target);
match target.as_str() {
"x86_64-unknown-linux-gnu" | "aarch64-unknown-linux-gnu" => {
// Cargo treats nonexistent files changed, so we only emit the rerun-if-changed
// directive when we expect the target-specific pre-generated binding file to be
// present.
println!("cargo:rerun-if-changed=bindings/{}-bindings.rs", &target);

file_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("bindings")
.join(format!("{}-bindings.rs", &target));
Expand Down

0 comments on commit 1e9392f

Please sign in to comment.