From a729b6e9a037bc86912cd3e5addcf109245473fc Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Tue, 25 May 2021 18:53:12 +0100 Subject: [PATCH] Only register Flight.proto with cargo if it exists --- arrow-flight/build.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arrow-flight/build.rs b/arrow-flight/build.rs index bc84f37c4a58..1cbfceb9262c 100644 --- a/arrow-flight/build.rs +++ b/arrow-flight/build.rs @@ -23,9 +23,6 @@ use std::{ }; fn main() -> Result<(), Box> { - // avoid rerunning build if the file has not changed - println!("cargo:rerun-if-changed=../format/Flight.proto"); - // override the build location, in order to check in the changes to proto files env::set_var("OUT_DIR", "src"); @@ -33,6 +30,9 @@ fn main() -> Result<(), Box> { // built or released so we build an absolute path to the proto file let path = Path::new("../format/Flight.proto"); if path.exists() { + // avoid rerunning build if the file has not changed + println!("cargo:rerun-if-changed=../format/Flight.proto"); + tonic_build::compile_protos("../format/Flight.proto")?; // read file contents to string let mut file = OpenOptions::new()