Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Rust protoc in Oak utils #533

Merged
merged 24 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/programming-oak.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ next section.
### Generated gRPC service code

The Oak SDK includes a `proto_rust_grpc` tool (forked from
https://github.com/stepancheg/rust-protobuf) which takes a
[gRPC service definition](https://grpc.io/docs/guides/concepts/) and
autogenerates Rust code for the corresponding Oak Node that implements that
https://github.com/stepancheg/rust-protobuf and wrapped in the `oak_utils`)
which takes a [gRPC service definition](https://grpc.io/docs/guides/concepts/)
and autogenerates Rust code for the corresponding Oak Node that implements that
service.

Adding a `build.rs` file to the Node that invokes this tool results in a
Expand All @@ -124,10 +124,10 @@ generated file appearing in `src/proto/<service>_grpc.rs`.
[embedmd]:# (../examples/hello_world/module/rust/build.rs Rust /fn main/ /^}/)
```Rust
fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/hello_world.proto"],
includes: &["../../proto", "../../third_party"],
includes: &["../../proto", "../../../../third_party"],
rust_protobuf: true, // also generate protobuf messages, not just services
..Default::default()
})
Expand Down
29 changes: 27 additions & 2 deletions examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ oak_derive = { path = "../sdk/rust/oak_derive" }
oak_log = { path = "../sdk/rust/oak_log" }
oak_runtime = { path = "../oak/server/rust/oak_runtime" }
oak_tests = { path = "../sdk/rust/oak_tests" }
oak_utils = { path = "../sdk/rust/oak_utils" }
1 change: 1 addition & 0 deletions examples/abitest/module_0/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ serde = { version = "*", features = ["derive"] }
serde_json = "*"

[build-dependencies]
oak_utils = "*"
protoc-rust-grpc = { path = "../../../../third_party/grpc-rust/protoc-rust-grpc" }
4 changes: 2 additions & 2 deletions examples/abitest/module_0/rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/abitest.proto"],
includes: &["../../proto", "../../third_party"],
includes: &["../../proto", "../../../../third_party"],
rust_protobuf: true, // also generate protobuf messages, not just services
..Default::default()
})
Expand Down
1 change: 1 addition & 0 deletions examples/hello_world/module/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ serial_test = "*"
serial_test_derive = "*"

[build-dependencies]
oak_utils = "*"
protoc-rust-grpc = { path = "../../../../third_party/grpc-rust/protoc-rust-grpc" }
4 changes: 2 additions & 2 deletions examples/hello_world/module/rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/hello_world.proto"],
includes: &["../../proto", "../../third_party"],
includes: &["../../proto", "../../../../third_party"],
rust_protobuf: true, // also generate protobuf messages, not just services
..Default::default()
})
Expand Down
1 change: 1 addition & 0 deletions examples/private_set_intersection/module/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ oak_derive = "*"
protobuf = "*"

[build-dependencies]
oak_utils = "*"
protoc-rust-grpc = { path = "../../../../third_party/grpc-rust/protoc-rust-grpc" }
2 changes: 1 addition & 1 deletion examples/private_set_intersection/module/rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/private_set_intersection.proto"],
includes: &["../../proto"],
Expand Down
1 change: 1 addition & 0 deletions examples/running_average/module/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ oak_derive = "*"
protobuf = "*"

[build-dependencies]
oak_utils = "*"
protoc-rust-grpc = { path = "../../../../third_party/grpc-rust/protoc-rust-grpc" }
2 changes: 1 addition & 1 deletion examples/running_average/module/rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/running_average.proto"],
includes: &["../../proto"],
Expand Down
1 change: 1 addition & 0 deletions examples/rustfmt/module/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ protobuf = "*"
rustfmt-nightly = "*"

[build-dependencies]
oak_utils = "*"
protoc-rust-grpc = { path = "../../../../third_party/grpc-rust/protoc-rust-grpc" }
2 changes: 1 addition & 1 deletion examples/rustfmt/module/rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/rustfmt.proto"],
includes: &["../../proto"],
Expand Down
Loading