Gunnar

nordisk/edda

crates/jera/build.rs

// build.rs — pure-Rust (protox, no protoc) codegen for the `agent-grpc` transport.
// Gated on the feature so jera's lean default does no proto work. Mirrors
// nornir-funnel-embed/build.rs.
fn main() {
    println!("cargo:rerun-if-changed=proto/agent.proto");
    println!("cargo:rerun-if-changed=build.rs");
    if std::env::var("CARGO_FEATURE_AGENT_GRPC").is_err() {
        return; // lean build: no gRPC, no codegen
    }
    let fds = protox::compile(["proto/agent.proto"], ["proto"]).expect("protox: compile agent.proto");
    tonic_prost_build::configure()
        .build_server(true)
        .build_client(true)
        .compile_fds(fds)
        .expect("tonic-build: agent codegen");
}