Skip to content

Commit

Permalink
feat: Add vendored support
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Jul 13, 2023
1 parent 2c831ba commit 36fccfd
Show file tree
Hide file tree
Showing 31 changed files with 12,703 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/generated/* binary
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ edition = "2021"

[features]
default = ["prometheus/process"]
vendored = []
# Enable integration tests with a running TiKV and PD instance.
# Use $PD_ADDRS, comma separated, to set the addresses the tests use.
integration-tests = []
Expand Down Expand Up @@ -39,7 +40,6 @@ tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }
tonic = { version = "0.9", features = ["tls"] }

[dev-dependencies]
tempfile = "3.6"
clap = "2"
env_logger = "0.10"
fail = { version = "0.4", features = ["failpoints"] }
Expand All @@ -51,6 +51,7 @@ reqwest = { version = "0.11", default-features = false, features = [
serde_json = "1"
serial_test = "0.5.0"
simple_logger = "1"
tempfile = "3.6"
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }

[build-dependencies]
Expand Down
32 changes: 18 additions & 14 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.

use tonic_disable_doctest::BuilderEx;

fn main() {
tonic_build::configure()
.disable_doctests_for_types([".google.api.HttpRule"])
.build_server(false)
.include_file("mod.rs")
.compile(
&glob::glob("proto/*.proto")
.unwrap()
.collect::<Result<Vec<_>, _>>()
.unwrap(),
&["proto/include", "proto"],
)
.unwrap();
#[cfg(feature = "vendored")]
{
use tonic_disable_doctest::BuilderEx;

tonic_build::configure()
.disable_doctests_for_types([".google.api.HttpRule"])
.build_server(false)
.include_file("mod.rs")
.out_dir("src/generated")
.compile(
&glob::glob("proto/*.proto")
.unwrap()
.collect::<Result<Vec<_>, _>>()
.unwrap(),
&["proto/include", "proto"],
)
.unwrap();
}
}
Loading

0 comments on commit 36fccfd

Please sign in to comment.