forked from protolambda/erigon-interfaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
56 lines (44 loc) · 1.38 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use std::{env, path::PathBuf};
fn config() -> prost_build::Config {
let mut config = prost_build::Config::new();
config.bytes(&["."]);
config
}
fn make_protos(protos: &[&str]) {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
tonic_build::configure()
.file_descriptor_set_path(out_dir.join("descriptor.bin"))
.compile_with_config(config(), protos, &["."])
.unwrap();
}
fn main() {
std::env::set_var("PROTOC", protobuf_src::protoc());
let mut protos = vec!["types/types.proto"];
if cfg!(feature = "sentry") {
protos.push("p2psentry/sentry.proto");
}
if cfg!(feature = "sentinel") {
protos.push("p2psentinel/sentinel.proto");
}
if cfg!(feature = "remotekv") {
protos.push("remote/ethbackend.proto");
protos.push("remote/kv.proto");
}
if cfg!(feature = "snapshotsync") {
protos.push("downloader/downloader.proto");
}
if cfg!(feature = "txpool") {
protos.push("txpool/mining.proto");
protos.push("txpool/txpool.proto");
}
if cfg!(feature = "execution") {
protos.push("execution/execution.proto");
}
if cfg!(feature = "web3") {
protos.push("web3/common.proto");
protos.push("web3/debug.proto");
protos.push("web3/eth.proto");
protos.push("web3/trace.proto");
}
make_protos(&protos);
}