// The gRPC code for the Open Inference Protocol (feature `grpc`). The built-in ONNX models are
// generated by furnace-burn's build script.
fn main() {
// Without it, Cargo would run this script again after any change in the package
println!("cargo:rerun-if-changed=build.rs");
#[cfg(feature = "grpc")]
compile_grpc();
}
/// Rust types and the service trait for the Open Inference Protocol's gRPC API, from
/// proto/open_inference_grpc.proto. protox parses the file in pure Rust, so no `protoc` is needed.
#[cfg(feature = "grpc")]
fn compile_grpc() {
println!("cargo:rerun-if-changed=proto/open_inference_grpc.proto");
let descriptors = protox::compile(["open_inference_grpc.proto"], ["proto"])
.expect("failed to parse proto/open_inference_grpc.proto");
tonic_prost_build::configure()
.build_server(true)
.build_client(true)
.compile_fds(descriptors)
.expect("failed to generate the gRPC code");
}