2021-04-14 07:26:32 +00:00
|
|
|
fn config() -> prost_build::Config {
|
|
|
|
let mut config = prost_build::Config::new();
|
|
|
|
config.protoc_arg("--experimental_allow_proto3_optional");
|
|
|
|
config.bytes(&["."]);
|
|
|
|
config
|
|
|
|
}
|
|
|
|
|
|
|
|
fn make_protos(protos: &[&str]) {
|
|
|
|
tonic_build::configure()
|
2021-05-22 10:00:13 +00:00
|
|
|
.format(false)
|
2021-04-14 07:26:32 +00:00
|
|
|
.compile_with_config(config(), &protos, &["."])
|
|
|
|
.unwrap();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut protos = vec!["types/types.proto"];
|
|
|
|
|
|
|
|
if cfg!(feature = "consensus") {
|
|
|
|
protos.push("consensus_engine/consensus.proto");
|
|
|
|
}
|
|
|
|
|
|
|
|
if cfg!(feature = "sentry") {
|
|
|
|
protos.push("p2psentry/sentry.proto");
|
|
|
|
}
|
|
|
|
|
|
|
|
if cfg!(feature = "remotekv") {
|
|
|
|
protos.push("remote/ethbackend.proto");
|
|
|
|
protos.push("remote/kv.proto");
|
|
|
|
}
|
|
|
|
|
|
|
|
if cfg!(feature = "snapshotsync") {
|
|
|
|
protos.push("snapshot_downloader/external_downloader.proto");
|
|
|
|
}
|
|
|
|
|
|
|
|
if cfg!(feature = "txpool") {
|
|
|
|
protos.push("txpool/txpool.proto");
|
|
|
|
protos.push("txpool/txpool_control.proto");
|
|
|
|
}
|
|
|
|
|
2021-05-22 10:00:13 +00:00
|
|
|
if cfg!(feature = "consensus") {
|
|
|
|
protos.push("consensus_engine/consensus.proto");
|
|
|
|
}
|
|
|
|
|
2021-04-14 07:26:32 +00:00
|
|
|
make_protos(&protos);
|
|
|
|
}
|