Skip to content

Commit

Permalink
Move client proto generation to oak_utils
Browse files Browse the repository at this point in the history
Update examples

Update functions
  • Loading branch information
ipetr0v committed Jun 29, 2020
1 parent 96362f3 commit c5e3176
Show file tree
Hide file tree
Showing 29 changed files with 106 additions and 215 deletions.
21 changes: 10 additions & 11 deletions examples/Cargo.lock

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

2 changes: 1 addition & 1 deletion examples/abitest/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ prost = "*"
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
17 changes: 1 addition & 16 deletions examples/abitest/grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#1093): drop this client crate and move all proto generation to common crate.
let proto_path = Path::new("../proto");
let file_path = proto_path.join("abitest.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

// Generate the normal (non-Oak) server and client code for the gRPC service,
// along with the Rust types corresponding to the message definitions.
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../proto", "abitest.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/aggregator/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ tokio = { version = "*", features = ["fs", "macros", "sync", "stream"] }
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
14 changes: 1 addition & 13 deletions examples/aggregator/backend/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let proto_path = Path::new("../../../examples/aggregator/proto");
let file_path = proto_path.join("aggregator.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

tonic_build::configure()
.build_client(false)
.build_server(true)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_server_proto("../../../examples/aggregator/proto", "aggregator.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/aggregator/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ prost = "*"
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
17 changes: 1 addition & 16 deletions examples/aggregator/grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#1093): drop this client crate and move all proto generation to common crate.
let proto_path = Path::new("../proto");
let file_path = proto_path.join("aggregator.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

// Generate the normal (non-Oak) server and client code for the gRPC service,
// along with the Rust types corresponding to the message definitions.
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../proto", "aggregator.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/authentication/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ tonic = { version = "*", features = ["tls"] }
url = "*"

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
14 changes: 1 addition & 13 deletions examples/authentication/client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let proto_path = Path::new("../../../oak/proto");
let file_path = proto_path.join("authentication.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../../../oak/proto", "authentication.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/hello_world/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ prost = "*"
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
17 changes: 1 addition & 16 deletions examples/hello_world/grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#1093): drop this client crate and move all proto generation to common crate.
let proto_path = Path::new("../proto");
let file_path = proto_path.join("hello_world.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

// Generate the normal (non-Oak) server and client code for the gRPC service,
// along with the Rust types corresponding to the message definitions.
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../proto", "hello_world.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/private_set_intersection/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ prost = "*"
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
17 changes: 1 addition & 16 deletions examples/private_set_intersection/grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#1093): drop this client crate and move all proto generation to common crate.
let proto_path = Path::new("../proto");
let file_path = proto_path.join("private_set_intersection.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

// Generate the normal (non-Oak) server and client code for the gRPC service,
// along with the Rust types corresponding to the message definitions.
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../proto", "private_set_intersection.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/running_average/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ prost = "*"
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
17 changes: 1 addition & 16 deletions examples/running_average/grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#1093): drop this client crate and move all proto generation to common crate.
let proto_path = Path::new("../proto");
let file_path = proto_path.join("running_average.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

// Generate the normal (non-Oak) server and client code for the gRPC service,
// along with the Rust types corresponding to the message definitions.
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../proto", "running_average.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/translator/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ prost = "*"
tonic = { version = "*", features = ["tls"] }

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
17 changes: 1 addition & 16 deletions examples/translator/grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,7 @@
// limitations under the License.
//

use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#1093): drop this client crate and move all proto generation to common crate.
let proto_path = Path::new("../proto");
let file_path = proto_path.join("translator.proto");

// 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
println!("cargo:rerun-if-changed={}", file_path.display());

// Generate the normal (non-Oak) server and client code for the gRPC service,
// along with the Rust types corresponding to the message definitions.
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&[file_path.as_path()], &[proto_path])?;
oak_utils::compile_client_proto("../proto", "translator.proto")?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/trusted_information_retrieval/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ quick-xml = { version = "*", features = ["serialize"] }
assert_matches = "*"

[build-dependencies]
tonic-build = "*"
oak_utils = "*"
Loading

0 comments on commit c5e3176

Please sign in to comment.