Skip to content

Commit

Permalink
Only register Flight.proto with cargo if it exists (#351) (#374)
Browse files Browse the repository at this point in the history
Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
  • Loading branch information
alamb and tustvold committed May 27, 2021
1 parent 0817783 commit f0702df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arrow-flight/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ use std::{
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
// 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");

// The current working directory can vary depending on how the project is being
// 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()
Expand Down

0 comments on commit f0702df

Please sign in to comment.