diff --git a/storage_broker/build.rs b/storage_broker/build.rs index 244c7217de..08dadeacd5 100644 --- a/storage_broker/build.rs +++ b/storage_broker/build.rs @@ -1,7 +1,11 @@ fn main() -> Result<(), Box> { - // Generate code to deterministic location to make finding it easier. - tonic_build::configure() - .out_dir("proto/") // put generated code to proto/ - .compile(&["proto/broker.proto"], &["proto/"])?; + // Generate rust code from .proto protobuf. + // + // Note: we previously tried to use deterministic location at proto/ for + // easy location, but apparently interference with cachepot sometimes fails + // the build then. Anyway, per cargo docs build script shouldn't output to + // anywhere but $OUT_DIR. + tonic_build::compile_protos("proto/broker.proto") + .unwrap_or_else(|e| panic!("failed to compile protos {:?}", e)); Ok(()) } diff --git a/storage_broker/src/lib.rs b/storage_broker/src/lib.rs index 39e72ca721..f25acdfcb3 100644 --- a/storage_broker/src/lib.rs +++ b/storage_broker/src/lib.rs @@ -11,7 +11,7 @@ use proto::{ // Code generated by protobuf. pub mod proto { - include!("../proto/storage_broker.rs"); + tonic::include_proto!("storage_broker"); } pub mod metrics;