pinnacle/pinnacle-api-defs/build.rs

24 lines
666 B
Rust
Raw Permalink Normal View History

use std::path::PathBuf;
fn main() {
2024-01-11 20:40:17 +01:00
println!("cargo:rerun-if-changed=../api/protocol");
2024-12-16 21:50:42 +01:00
let mut proto_paths = Vec::new();
for entry in walkdir::WalkDir::new("../api/protocol") {
let entry = entry.unwrap();
if entry.file_type().is_file() && entry.path().extension().is_some_and(|ext| ext == "proto")
{
proto_paths.push(entry.into_path());
}
}
let descriptor_path = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("pinnacle.bin");
tonic_build::configure()
.file_descriptor_set_path(descriptor_path)
2024-12-16 21:50:42 +01:00
.compile_protos(&proto_paths, &["../api/protocol"])
.unwrap();
}