fn main() {
use std::env;
use std::path::PathBuf;
if std::env::var_os("PROTOC").is_none() {
let protoc = protoc_bin_vendored::protoc_bin_path()
.expect("vendored protoc binary unavailable for this host target");
std::env::set_var("PROTOC", protoc);
}
let proto_root = PathBuf::from("proto");
let proto_files = vec![
proto_root.join("jammi/v1/error.proto"),
proto_root.join("jammi/v1/catalog.proto"),
proto_root.join("jammi/v1/trigger.proto"),
proto_root.join("jammi/v1/embedding.proto"),
proto_root.join("jammi/v1/inference.proto"),
proto_root.join("jammi/v1/eval.proto"),
proto_root.join("jammi/v1/pipeline.proto"),
proto_root.join("jammi/v1/training.proto"),
proto_root.join("jammi/v1/audit.proto"),
];
for f in &proto_files {
println!("cargo:rerun-if-changed={}", f.display());
}
println!("cargo:rerun-if-changed=proto");
let mut config = tonic_prost_build::Config::new();
config.enable_type_names();
config.type_name_domain(["."], "type.googleapis.com");
let descriptor_path =
PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is set for build scripts"))
.join("jammi_descriptor.bin");
tonic_prost_build::configure()
.build_client(true)
.build_server(true)
.file_descriptor_set_path(&descriptor_path)
.compile_with_config(
config,
&proto_files
.iter()
.map(|p| p.to_str().unwrap())
.collect::<Vec<_>>(),
&[proto_root.to_str().unwrap()],
)
.expect("failed to compile proto files");
}