kjuulh
a444bff1ee
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
29 lines
741 B
Rust
29 lines
741 B
Rust
use std::path::PathBuf;
|
|
|
|
fn main() {
|
|
println!("cargo:rerun-if-changed=main.rs");
|
|
|
|
let proto_dir = PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
|
|
.join("schemas")
|
|
.join("proto");
|
|
|
|
let proto_files = proto_dir
|
|
.read_dir()
|
|
.unwrap()
|
|
.flatten()
|
|
.map(|e| (e.path(), e.metadata()))
|
|
.filter_map(|(path, file_type)| {
|
|
file_type
|
|
.ok()
|
|
.filter(|file_type| file_type.is_file())
|
|
.map(|_| path)
|
|
})
|
|
.collect::<Vec<_>>();
|
|
|
|
if proto_files.is_empty() {
|
|
panic!("failed to find any proto files in {}", proto_dir.display());
|
|
}
|
|
|
|
tonic_build::compile_protos(proto_files.first().unwrap()).unwrap();
|
|
}
|