const PROTOBUF_BASE_DIRECTORY: &str = "src/protocol";
const PROTOBUF_FILES: [&str; 4] = ["meta", "node", "auth", "control"];
fn build_protobufs() {
let path = protoc_bin_vendored::protoc_bin_path().expect("Failed to find protoc installation");
std::env::set_var("PROTOC", path);
let mut protobuf_files = Vec::with_capacity(PROTOBUF_FILES.len());
for file in PROTOBUF_FILES.iter() {
let proto_file = format!("{PROTOBUF_BASE_DIRECTORY}/{file}.proto");
println!("cargo:rerun-if-changed={proto_file}");
protobuf_files.push(proto_file);
}
prost_build::compile_protos(&protobuf_files, &[PROTOBUF_BASE_DIRECTORY]).unwrap();
}
fn main() {
build_protobufs();
}