This repository was archived by the owner on Apr 16, 2020. It is now read-only.
This repository was archived by the owner on Apr 16, 2020. It is now read-only.
Wrong use
path when using well known proto type
#209
Open
Description
tower-grpc-build
may generate wrong use
path when using well known proto type
s, say google/protobuf/timestamp.proto
.
Cargo dependencies:
[dependencies]
tower-grpc = {version = "~0.1", features = ["tower-hyper"] }
tower-hyper = "~0.1"
prost = "~0.5"
prost-types = "~0.5"
prost-derive = "~0.5"
futures = "~0.1"
bytes = "~0.4"
[build-dependencies]
tower-grpc-build = { version = "~0.1", features = ["tower-hyper"] }
/// build.rs
extern crate tower_grpc_build;
fn main() {
println!("Starting build");
// prefer writing the compiled proto code to src folder
std::env::set_var("OUT_DIR", "src/");
tower_grpc_build::Config::new()
.enable_server(true)
.enable_client(true)
.build(&["proto/test.proto"], &["proto"])
.unwrap_or_else(|e| panic!("protobuf compilation failed: {}", e));
println!("cargo:rerun-if-changed=proto/test.proto");
}
syntax = "proto3";
package test;
option optimize_for = SPEED;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service Service {
rpc GetTime(google.protobuf.Empty) returns (google.protobuf.Timestamp) {}
}
And the generated rust file is:
pub mod client {
use ::tower_grpc::codegen::client::*;
use super::::prost_types::Timestamp; // Error line! Which should be `use ::prost_types::Timestamp;`
#[derive(Debug, Clone)]
pub struct Service<T> {
inner: grpc::Grpc<T>,
}
...
Metadata
Metadata
Assignees
Labels
No labels