2022-10-08 04:30:12 -06:00
|
|
|
use std::fs;
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2023-01-30 07:36:16 -07:00
|
|
|
println!("cargo:rerun-if-changed=../../proto/generate.proto");
|
2022-10-08 04:30:12 -06:00
|
|
|
fs::create_dir("src/pb").unwrap_or(());
|
|
|
|
tonic_build::configure()
|
|
|
|
.build_client(true)
|
|
|
|
.build_server(false)
|
|
|
|
.out_dir("src/pb")
|
|
|
|
.include_file("mod.rs")
|
|
|
|
.compile(&["../../proto/generate.proto"], &["../../proto"])
|
|
|
|
.unwrap_or_else(|e| panic!("protobuf compilation failed: {}", e));
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|