From 12a4fd1a57f1695ca988be57947ff900223beace Mon Sep 17 00:00:00 2001 From: Jason LeBrun Date: Wed, 3 Jan 2024 20:20:31 +0000 Subject: [PATCH] Don't use WORKSPACE_ROOT to resolve protos. --- oak_attestation_verification/build.rs | 3 +-- oak_functions_abi/build.rs | 9 ++------- oak_functions_launcher/build.rs | 7 ++----- oak_functions_sdk/build.rs | 7 ++----- oak_functions_service/build.rs | 7 ++----- oak_remote_attestation/build.rs | 16 +++++----------- 6 files changed, 14 insertions(+), 35 deletions(-) diff --git a/oak_attestation_verification/build.rs b/oak_attestation_verification/build.rs index ddcf9454f53..422da6d9b29 100644 --- a/oak_attestation_verification/build.rs +++ b/oak_attestation_verification/build.rs @@ -21,8 +21,7 @@ fn main() -> Result<(), Box> { "proto/attestation/reference_value.proto", "proto/attestation/verification.proto", ]; - prost_build::compile_protos(&proto_paths, &[env!("WORKSPACE_ROOT")]) - .expect("proto compilation failed"); + prost_build::compile_protos(&proto_paths, &[".."]).expect("proto compilation failed"); // Tell cargo to rerun this build script if the proto file has changed. // https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-changedpath diff --git a/oak_functions_abi/build.rs b/oak_functions_abi/build.rs index 53594a16477..f8eda6b0508 100644 --- a/oak_functions_abi/build.rs +++ b/oak_functions_abi/build.rs @@ -21,17 +21,12 @@ fn main() { "proto/oak_functions/abi.proto", "proto/oak_functions/lookup_data.proto", ]; - prost_build::compile_protos(&file_paths, &[env!("WORKSPACE_ROOT")]) - .expect("proto compilation failed"); + prost_build::compile_protos(&file_paths, &[".."]).expect("proto compilation failed"); // Tell cargo to rerun this build script if the proto file has changed. // https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-changedpath for proto_path in file_paths.iter() { let file_path = std::path::Path::new(proto_path); - println!( - "cargo:rerun-if-changed={}{}", - env!("WORKSPACE_ROOT"), - file_path.display() - ); + println!("cargo:rerun-if-changed=../{}", file_path.display()); } } diff --git a/oak_functions_launcher/build.rs b/oak_functions_launcher/build.rs index 5126dd67047..33ad05e5af4 100644 --- a/oak_functions_launcher/build.rs +++ b/oak_functions_launcher/build.rs @@ -32,11 +32,8 @@ fn main() -> Result<(), Box> { // Generate micro RPC code for exchanging messages with the enclave. micro_rpc_build::compile( - &[format!( - "{}proto/oak_functions/service/oak_functions.proto", - env!("WORKSPACE_ROOT") - )], - &[env!("WORKSPACE_ROOT")], + &["proto/oak_functions/service/oak_functions.proto"], + &[".."], Default::default(), ); diff --git a/oak_functions_sdk/build.rs b/oak_functions_sdk/build.rs index 503d472344c..76ee4519598 100644 --- a/oak_functions_sdk/build.rs +++ b/oak_functions_sdk/build.rs @@ -16,11 +16,8 @@ fn main() { micro_rpc_build::compile( - &[format!( - "{}proto/oak_functions/sdk/oak_functions_wasm.proto", - env!("WORKSPACE_ROOT") - )], - &[format!("{}proto/oak_functions/sdk", env!("WORKSPACE_ROOT"))], + &["proto/oak_functions/sdk/oak_functions_wasm.proto"], + &[".."], Default::default(), ); } diff --git a/oak_functions_service/build.rs b/oak_functions_service/build.rs index b52be5d8b40..306c9a0124f 100644 --- a/oak_functions_service/build.rs +++ b/oak_functions_service/build.rs @@ -18,11 +18,8 @@ use micro_rpc_build::ReceiverType; fn main() { micro_rpc_build::compile( - &[format!( - "{}proto/oak_functions/service/oak_functions.proto", - env!("WORKSPACE_ROOT") - )], - &[env!("WORKSPACE_ROOT")], + &["proto/oak_functions/service/oak_functions.proto"], + &[".."], micro_rpc_build::CompileOptions { receiver_type: ReceiverType::RefSelf, bytes: vec![".oak.functions.LookupDataEntry".to_string()], diff --git a/oak_remote_attestation/build.rs b/oak_remote_attestation/build.rs index a8be9fe748c..c7237ea2067 100644 --- a/oak_remote_attestation/build.rs +++ b/oak_remote_attestation/build.rs @@ -17,18 +17,12 @@ fn main() -> Result<(), Box> { micro_rpc_build::compile( &[ - &format!( - "{}oak_remote_attestation/proto/v1/messages.proto", - env!("WORKSPACE_ROOT") - ), - &format!("{}proto/attestation/dice.proto", env!("WORKSPACE_ROOT")), - &format!("{}proto/attestation/evidence.proto", env!("WORKSPACE_ROOT")), - &format!( - "{}proto/attestation/endorsement.proto", - env!("WORKSPACE_ROOT") - ), + "oak_remote_attestation/proto/v1/messages.proto", + "proto/attestation/dice.proto", + "proto/attestation/evidence.proto", + "proto/attestation/endorsement.proto", ], - &[env!("WORKSPACE_ROOT")], + &[".."], Default::default(), );