Skip to content

Commit 4fa354d

Browse files
committed
Using prost conveniently generates Rust code at the build time without the code having to be checked into git.
1 parent f49d053 commit 4fa354d

File tree

6 files changed

+8
-2641
lines changed

6 files changed

+8
-2641
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ features = ["nightly"]
1919

2020
[features]
2121
default = ["protobuf"]
22-
gen = ["prost-build"]
2322
nightly = ["libc"]
2423
process = ["libc", "procfs"]
25-
protobuf = ["prost"]
24+
protobuf = ["prost", "prost-build"]
2625
push = ["reqwest", "libc", "protobuf"]
2726

2827
[dependencies]

build.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
22

3-
#[cfg(feature = "gen")]
3+
#[cfg(feature = "protobuf")]
44
fn generate_protobuf_binding_file() {
5-
use prost_build::Config;
6-
use std::path::Path;
7-
8-
let mut cfg = Config::new();
9-
cfg.out_dir(Path::new("proto"));
10-
cfg.compile_protos(&["proto/proto_model.proto"], &["proto"])
11-
.unwrap();
5+
prost_build::compile_protos(&["proto/proto_model.proto"], &["proto"]).unwrap();
126
}
137

14-
#[cfg(not(feature = "gen"))]
8+
#[cfg(not(feature = "protobuf"))]
159
fn generate_protobuf_binding_file() {}
1610

1711
fn main() {

proto/io.prometheus.client.rs

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)