feat(build): Support compiling well-known protobuf types (#522)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "wellknown-compiled"
|
||||
version = "0.1.0"
|
||||
authors = ["Lucio Franco <[email protected]>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
license = "MIT"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
tonic = { path = "../../tonic" }
|
||||
prost = "0.7"
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = { path = "../../tonic-build" }
|
||||
@@ -0,0 +1,6 @@
|
||||
fn main() {
|
||||
tonic_build::configure()
|
||||
.compile_well_known_types(true)
|
||||
.compile(&["proto/google.proto"], &["proto"])
|
||||
.unwrap();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/api.proto";
|
||||
import "google/protobuf/descriptor.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/source_context.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/type.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
pub mod google {
|
||||
pub mod protobuf {
|
||||
tonic::include_proto!("google.protobuf");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn grok() {
|
||||
let _empty = crate::google::protobuf::Empty {};
|
||||
}
|
||||
Reference in New Issue
Block a user