use std::path::Path; fn main() -> Result<(), Box> { let proto_dir = Path::new("proto/core"); let protos: Vec<_> = walkdir::WalkDir::new(proto_dir) .into_iter() .filter_map(|e| e.ok()) .filter(|e| e.path().extension().is_some_and(|ext| ext == "proto")) .map(|e| e.path().to_owned()) .collect(); for proto in &protos { println!("cargo:rerun-if-changed={}", proto.display()); } let includes = vec![proto_dir.to_path_buf()]; tonic_prost_build::configure() .build_server(false) .build_client(true) .compile_protos(&protos, &includes)?; Ok(()) }