You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
825 B
27 lines
825 B
use std::fs::read_dir;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
println!("cargo:rerun-if-changed=../protobuf/");
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
let mut files = Vec::new();
|
|
for f in read_dir("../protobuf").unwrap() {
|
|
if let Ok(f) = f {
|
|
if f.path().is_file() && f.path().extension().map(|x| x == "proto").unwrap_or(false) {
|
|
files.push(f.path());
|
|
}
|
|
}
|
|
}
|
|
if let Err(e) = prost_build::Config::new().out_dir("src/server/protos").compile_protos(&files, &["../protobuf".into(), "../protobuf/include".into()]) {
|
|
eprintln!("{}", e);
|
|
return Err(e.into());
|
|
}
|
|
// if let Err(e) = tonic_build::configure()
|
|
// .build_client(false)
|
|
// .out_dir("src/server/grpc")
|
|
// .compile(&files, &["../protobuf".into()])
|
|
// {
|
|
// eprintln!("{}", e);
|
|
// return Err(e.into());
|
|
// };
|
|
Ok(())
|
|
}
|
|
|