fix(build): Correctly convert Empty to () (#734)
This commit is contained in:
@@ -16,4 +16,5 @@ tonic = { path = "../../tonic" }
|
||||
prost = "0.9"
|
||||
|
||||
[build-dependencies]
|
||||
prost-build = "0.9"
|
||||
tonic-build = { path = "../../tonic-build" }
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
fn main() {
|
||||
let mut config = prost_build::Config::new();
|
||||
config.extern_path(".google.protobuf.Empty", "()");
|
||||
|
||||
tonic_build::configure()
|
||||
.compile_well_known_types(true)
|
||||
.compile(&["proto/google.proto"], &["proto"])
|
||||
.compile_with_config(
|
||||
config,
|
||||
&["proto/google.proto", "proto/test.proto"],
|
||||
&["proto"],
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
package test;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
message Input {
|
||||
}
|
||||
|
||||
service Service {
|
||||
rpc Call(Input) returns (google.protobuf.Empty);
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
pub mod google {
|
||||
pub mod protobuf {
|
||||
tonic::include_proto!("google.protobuf");
|
||||
pub mod gen {
|
||||
pub mod google {
|
||||
pub mod protobuf {
|
||||
tonic::include_proto!("google.protobuf");
|
||||
}
|
||||
}
|
||||
|
||||
pub mod test {
|
||||
tonic::include_proto!("test");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn grok() {
|
||||
let _empty = crate::google::protobuf::Empty {};
|
||||
let _any = crate::gen::google::protobuf::Any {
|
||||
type_url: "foo".to_owned(),
|
||||
value: Vec::new(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user