Skip to content

Commit

Permalink
Using prost conveniently generates Rust code at the build time withou…
Browse files Browse the repository at this point in the history
…t the code having to be checked into git.
  • Loading branch information
Folyd committed Feb 7, 2021
1 parent f49d053 commit 4fa354d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 2,641 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ features = ["nightly"]

[features]
default = ["protobuf"]
gen = ["prost-build"]
nightly = ["libc"]
process = ["libc", "procfs"]
protobuf = ["prost"]
protobuf = ["prost", "prost-build"]
push = ["reqwest", "libc", "protobuf"]

[dependencies]
Expand Down
12 changes: 3 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.

#[cfg(feature = "gen")]
#[cfg(feature = "protobuf")]
fn generate_protobuf_binding_file() {
use prost_build::Config;
use std::path::Path;

let mut cfg = Config::new();
cfg.out_dir(Path::new("proto"));
cfg.compile_protos(&["proto/proto_model.proto"], &["proto"])
.unwrap();
prost_build::compile_protos(&["proto/proto_model.proto"], &["proto"]).unwrap();
}

#[cfg(not(feature = "gen"))]
#[cfg(not(feature = "protobuf"))]
fn generate_protobuf_binding_file() {}

fn main() {
Expand Down
94 changes: 0 additions & 94 deletions proto/io.prometheus.client.rs

This file was deleted.

Loading

0 comments on commit 4fa354d

Please sign in to comment.