fix(build): Don't replace extern_paths (#261)
* don't replace extern_path'd paths tonic-build will replace all paths except for google well known types with one rooted at the super module. For paths that have already been replaced with a fully qualified path via the extern_path config option, (e.g. "::uuid::Uuid"), this results in an invalid path (e.g. "super::::uuid::Uuid"), and a build failure. These paths should also be excluded when prefixing relative modules with super. * add doc in tonic-build clarifying extern_path extern_path expects fully qualified proto and rust paths * add test cast case for extern path fix add a test that extern path does indeed result in service types using the specified type from an external crate. we test this by creating a service type that has a proto from a different crate, and asserting that it does indeed impl a trait from that crate * add license/publish to extern_path test crates
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package my_application;
|
||||
|
||||
option go_package = "my_applicationpb";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ServiceProto";
|
||||
option java_package = "com.my_application";
|
||||
|
||||
|
||||
import "uuid.proto";
|
||||
|
||||
message MyMessage {
|
||||
uuid.Uuid message_id = 1;
|
||||
string some_payload = 2;
|
||||
}
|
||||
|
||||
service MyService {
|
||||
rpc GetUuid(MyMessage) returns (uuid.Uuid){
|
||||
|
||||
}
|
||||
rpc GetMyMessage(uuid.Uuid) returns (MyMessage){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package uuid;
|
||||
|
||||
option go_package = "uuidpb";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "UuidProto";
|
||||
option java_package = "com.uuid";
|
||||
|
||||
|
||||
message Uuid {
|
||||
string uuid_str = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user