2024-09-09 17:11:37 +02:00
|
|
|
use std::{env, path::PathBuf};
|
|
|
|
|
2024-09-05 16:12:58 +02:00
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2024-09-09 17:11:37 +02:00
|
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
2024-09-11 20:55:16 +02:00
|
|
|
std::env::set_var("CARGO_MANIFEST_DIR", std::env::var("PWD").unwrap());
|
|
|
|
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
|
|
let proto_dir = manifest_dir.join("./protos/");
|
|
|
|
let proto_dir_file = manifest_dir.join("./protos/protocol.proto");
|
|
|
|
|
2024-09-09 17:11:37 +02:00
|
|
|
|
|
|
|
tonic_build::configure()
|
|
|
|
.file_descriptor_set_path(out_dir.join("protocol_descriptor.bin"))
|
2024-09-11 20:55:16 +02:00
|
|
|
// .compile(&["../protos/protocol.proto"], &["../protos"])?;
|
|
|
|
.compile(&[proto_dir_file.clone()], &[proto_dir])?;
|
|
|
|
tonic_build::compile_protos(proto_dir_file)?;
|
2024-09-05 16:12:58 +02:00
|
|
|
Ok(())
|
|
|
|
}
|