fn main() -> Result<(), Box<dyn std::error::Error>> {
let output = std::process::Command::new("buf")
.arg("export")
.arg("buf.build/aham/proto")
.arg("-o")
.arg("proto_files")
.output()
.expect("failed to execute buf export");
let stdout = String::from_utf8_lossy(&output.stdout);
if !stdout.is_empty() {
println!("Buf output: {}", stdout);
}
tonic_prost_build::configure()
.build_server(false)
.compile_protos(
&[
"proto_files/aham/services/iam/iam.proto",
],
&["proto_files"],
)?;
tonic_prost_build::configure()
.build_server(true)
.compile_protos(
&[
"proto_files/aham/services/tourism/front.proto",
"proto_files/aham/services/tourism/vo.proto"
],
&["proto_files"],
)?;
if std::path::Path::new("proto_files").exists() {
std::fs::remove_dir_all("proto_files").expect("failed to remove proto_files");
}
Ok(())
}