-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): Support compiling well-known protobuf types (#522)
- Loading branch information
Showing
9 changed files
with
200 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "wellknown-compiled" | ||
version = "0.1.0" | ||
authors = ["Lucio Franco <luciofranco14@gmail.com>"] | ||
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" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn main() { | ||
tonic_build::configure() | ||
.compile_well_known_types(true) | ||
.compile(&["proto/google.proto"], &["proto"]) | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pub mod google { | ||
pub mod protobuf { | ||
tonic::include_proto!("google.protobuf"); | ||
} | ||
} | ||
|
||
pub fn grok() { | ||
let _empty = crate::google::protobuf::Empty {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.