feat(build): Decouple codgen from prost (#170)

This commit is contained in:
Gyusun Yeom
2020-03-01 13:52:31 -05:00
committed by GitHub
parent 1b3d107206
commit f65cda1ea0
20 changed files with 550 additions and 356 deletions
+2 -2
View File
@@ -103,7 +103,7 @@ name = "hyper-warp-server"
path = "src/hyper_warp/server.rs"
[dependencies]
tonic = { path = "../tonic", features = ["tls"] }
tonic = { path = "../tonic", features = ["tls", "data-prost"] }
prost = "0.6"
tokio = { version = "0.2", features = ["rt-threaded", "time", "stream", "fs", "macros", "uds"] }
futures = { version = "0.3", default-features = false, features = ["alloc"] }
@@ -128,4 +128,4 @@ http-body = "0.3"
pin-project = "0.4"
[build-dependencies]
tonic-build = { path = "../tonic-build" }
tonic-build = { path = "../tonic-build", features = ["prost"] }
+4 -4
View File
@@ -1,6 +1,6 @@
fn main() {
tonic_build::compile_protos("proto/helloworld/helloworld.proto").unwrap();
tonic_build::compile_protos("proto/routeguide/route_guide.proto").unwrap();
tonic_build::compile_protos("proto/echo/echo.proto").unwrap();
tonic_build::compile_protos("proto/google/pubsub/pubsub.proto").unwrap();
tonic_build::prost::compile_protos("proto/helloworld/helloworld.proto").unwrap();
tonic_build::prost::compile_protos("proto/routeguide/route_guide.proto").unwrap();
tonic_build::prost::compile_protos("proto/echo/echo.proto").unwrap();
tonic_build::prost::compile_protos("proto/google/pubsub/pubsub.proto").unwrap();
}
+1 -1
View File
@@ -129,7 +129,7 @@ At the root of your crate, create a `build.rs` file and add the following code:
```rust
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/helloworld.proto")?;
tonic_build::prost::compile_protos("proto/helloworld.proto")?;
Ok(())
}
```
+2 -2
View File
@@ -199,7 +199,7 @@ Create a `build.rs` file at the root of your crate:
```rust
fn main() {
tonic_build::compile_protos("proto/route_guide.proto")
tonic_build::prost::compile_protos("proto/route_guide.proto")
.unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));
}
```
@@ -823,7 +823,7 @@ opposed to at build time, placing the resulting modules wherever we need them.
```rust
fn main() {
tonic_build::configure()
tonic_build::prost::configure()
.build_client(false)
.out_dir("another_crate/src/pb")
.compile(&["path/my_proto.proto"], &["path"])