const PROTOBUF_FILES: [&str; 1] = ["src/proto/audit"];
fn build_protobuf(file: &str) {
let proto_file = format!("{}.proto", file);
println!("cargo:rerun-if-changed={}.rs", file);
println!("cargo:rerun-if-changed={}.proto", file);
protobuf_codegen::Codegen::new()
.protoc()
.protoc_path(&protoc_bin_vendored::protoc_bin_path().unwrap())
.includes(&["src/proto"])
.input(&proto_file)
.cargo_out_dir("proto")
.run_from_script();
}
fn build_protobufs() {
for file in PROTOBUF_FILES.iter() {
build_protobuf(file);
}
}
fn main() {
match std::env::var("CARGO_FEATURE_PROTOBUF") {
Err(_) => {}
_ => {
build_protobufs();
}
}
}