Skip to content

Commit

Permalink
Get interfaces.proto working
Browse files Browse the repository at this point in the history
Finally figured out how to get those well-known protos in!

Change-Id: I4fd1d422a8f7a3734eadab84d98bf77eda1df5c5
  • Loading branch information
jblebrun committed Apr 11, 2024
1 parent a70ce99 commit 7ee62c2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
3 changes: 0 additions & 3 deletions oak_containers/proto/interfaces.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ syntax = "proto3";
package oak.containers;

import "google/protobuf/empty.proto";
import "proto/crypto/crypto.proto";
import "proto/attestation/endorsement.proto";
import "proto/attestation/evidence.proto";
import "proto/session/messages.proto";

// As images can be large (hundreds of megabytes), the launcher chunks up the
// response into smaller pieces to respect proto/gRPC limits. The image needs to
Expand Down
1 change: 1 addition & 0 deletions oak_proto_rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ cargo_build_script(
},
crate_features = ["bazel"],
data = [
"//oak_containers/proto:interfaces_proto",
"//proto:digest_proto",
"//proto/attestation:attachment_proto",
"//proto/attestation:dice_proto",
Expand Down
17 changes: 15 additions & 2 deletions oak_proto_rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

fn main() -> Result<(), Box<dyn std::error::Error>> {
let proto_paths = [
"../oak_containers/proto/interfaces.proto",
"../proto/attestation/attachment.proto",
"../proto/attestation/dice.proto",
"../proto/attestation/endorsement.proto",
Expand All @@ -30,12 +31,24 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut config = prost_build::Config::new();
config
.btree_map(["."]) // Support no-std proto maps
.compile_protos(&proto_paths, &[".."])
.compile_protos(
&proto_paths,
&[
"..",
// We need to include the well-known protos ourselves
"../external/com_google_protobuf/src/google/protobuf/_virtual_imports/empty_proto",
"../external/com_google_protobuf/src/google/protobuf/_virtual_imports/descriptor_proto",
],
)
.expect("proto compilation failed");

micro_rpc_build::compile(
&["../proto/oak_functions/testing.proto", "../proto/crypto/crypto.proto"],
&[".."],
&[
"..",
// We need to include the well-known protos ourselves
"../external/com_google_protobuf/src/google/protobuf/_virtual_imports/descriptor_proto",
],
Default::default(),
);

Expand Down
10 changes: 8 additions & 2 deletions proto/oak_functions/testing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ syntax = "proto3";

package oak.functions.testing;

import "proto/micro_rpc/options.proto";

service TestModule {
// method_id: 0
rpc Lookup(LookupRequest) returns (LookupResponse) {}
rpc Lookup(LookupRequest) returns (LookupResponse) {
option (.oak.micro_rpc.method_id) = 0;
}
// method_id: 1
rpc EchoAndPanic(EchoAndPanicRequest) returns (EchoAndPanicResponse) {}
rpc EchoAndPanic(EchoAndPanicRequest) returns (EchoAndPanicResponse) {
option (.oak.micro_rpc.method_id) = 1;
}
}

message LookupRequest {
Expand Down

0 comments on commit 7ee62c2

Please sign in to comment.