use std::{env, fs, io::Result, path::PathBuf}; fn main() -> Result<()> { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); //let proto_dir = "proto"; //let paths = fs::read_dir(proto_dir).unwrap(); //for path in paths { // let path_str = path.unwrap().path().to_str().unwrap().to_string(); // let descriptor = format!("{}_descriptor.bin", path_str); // tonic_prost_build::configure() // .file_descriptor_set_path(out_dir.join("audio_backend_descriptor.bin")) // .compile_protos(&["proto/audio_backend.proto"], &["proto"]) // .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e)); //} let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); tonic_prost_build::configure() .file_descriptor_set_path(out_dir.join("audio_backend_descriptor.bin")) .compile_protos(&["proto/audio_backend.proto"], &["proto"]) .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e)); tonic_prost_build::configure() .file_descriptor_set_path(out_dir.join("track_descriptor.bin")) .compile_protos(&["proto/track.proto"], &["proto"]) .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e)); Ok(()) }