build.rs
1 use std::{env, path::PathBuf}; 2 3 static RUNNER_DESCRIPTOR_FILE: &str = "runner_v1_descriptor.bin"; 4 5 fn main() -> Result<(), Box<dyn std::error::Error>> { 6 let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); 7 println!("cargo:rerun-if-changed=proto/runner/v1"); 8 9 tonic_build::configure() 10 .build_client(true) 11 .build_server(true) 12 .protoc_arg("--experimental_allow_proto3_optional") 13 .file_descriptor_set_path(out_dir.join(RUNNER_DESCRIPTOR_FILE)) 14 .compile(&["proto/runner/v1/runner.proto"], &["proto/runner"])?; 15 16 Ok(()) 17 }