2024-10-03 22:06:32 +00:00
|
|
|
use std::{error::Error, path::PathBuf, process::Command};
|
2024-09-05 19:45:22 +00:00
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
let out_dir: PathBuf = "./src/generated/".into();
|
|
|
|
let proto_file: PathBuf = "../../proto/orchestrator.proto".into();
|
|
|
|
let proto_dir = proto_file.parent().unwrap();
|
|
|
|
|
2024-10-03 22:06:32 +00:00
|
|
|
match Command::new("protoc --version").spawn() {
|
|
|
|
Ok(_) => prost_build::Config::new()
|
|
|
|
.out_dir(out_dir)
|
|
|
|
.protoc_arg("--experimental_allow_proto3_optional")
|
|
|
|
.compile_protos(&[&proto_file], &[proto_dir])?,
|
|
|
|
Err(_) => {
|
|
|
|
// Skipping protobuf compilation.
|
|
|
|
}
|
|
|
|
}
|
2024-09-05 19:45:22 +00:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|