Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
26
crates/flux-releaser/build.rs
Normal file
26
crates/flux-releaser/build.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
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();
|
||||
}
|
Reference in New Issue
Block a user