feat: add protobuf
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-02-11 13:31:45 +01:00
parent 39d4109c36
commit ae1f91b2b1
5 changed files with 711 additions and 69 deletions

View 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();
}