Skip to content

Commit

Permalink
Don't use WORKSPACE_ROOT to resolve protos. (#4597)
Browse files Browse the repository at this point in the history
  • Loading branch information
jblebrun authored Jan 4, 2024
1 parent 9322367 commit c68edf6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 35 deletions.
3 changes: 1 addition & 2 deletions oak_attestation_verification/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"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
Expand Down
9 changes: 2 additions & 7 deletions oak_functions_abi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
7 changes: 2 additions & 5 deletions oak_functions_launcher/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

// 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(),
);

Expand Down
7 changes: 2 additions & 5 deletions oak_functions_sdk/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
}
7 changes: 2 additions & 5 deletions oak_functions_service/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down
16 changes: 5 additions & 11 deletions oak_remote_attestation/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
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(),
);

Expand Down

0 comments on commit c68edf6

Please sign in to comment.