fix(codegen): Use wellknown types from prost-types (#49)

This change introduces the ability to let prost-build
provide the fully qualifed type path for types that
start with `google.protobuf`.
This commit is contained in:
Lucio Franco
2019-10-05 13:16:09 -04:00
committed by GitHub
parent ed3e7e95a5
commit 4e1fcece15
6 changed files with 42 additions and 36 deletions
-7
View File
@@ -1,7 +0,0 @@
syntax = "proto3";
package empty;
import "google/protobuf/empty.proto";
service Admin {
rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty);
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto3";
package wellknown;
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/any.proto";
service Admin {
rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty);
rpc StringCall(google.protobuf.StringValue) returns (google.protobuf.Empty);
rpc AnyCall(google.protobuf.Any) returns (google.protobuf.Empty);
}
@@ -1,9 +1,9 @@
#[test]
fn empty() {
fn wellknown() {
let tmp = std::env::temp_dir();
tonic_build::configure()
.out_dir(tmp)
.format(false)
.compile(&["tests/protos/empty.proto"], &["tests/protos"])
.compile(&["tests/protos/wellknown.proto"], &["tests/protos"])
.unwrap();
}