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.
21 lines
503 B
21 lines
503 B
use std::fs::read_dir;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
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) = tonic_build::configure()
|
|
.build_client(false)
|
|
.out_dir("src/server/grpc")
|
|
.compile(&files, &["../protobuf".into()])
|
|
{
|
|
eprintln!("{}", e);
|
|
return Err(e.into());
|
|
};
|
|
Ok(())
|
|
}
|
|
|