Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/edda

crates/nornir-wire/build.rs

// build.rs — compile `proto/nornir.proto` into prost+tonic bindings for the
// `nornir.v1` package. This is the ONE home for the nornir wire codegen: it was
// lifted verbatim out of `nornir/build.rs` so nornir-server (producer) and the
// read-client(s) (consumer) both `include_proto!("nornir.v1")` from THIS crate's
// generated `pb` module instead of each running their own copy.
//
// We use `protox` (pure-Rust .proto parser) instead of a system / vendored
// `protoc` binary — keeping the build dep-tree 100% Rust, matching nornir's
// "no shellout, no C" rule.

fn main() {
    println!("cargo:rerun-if-changed=proto/nornir.proto");
    println!("cargo:rerun-if-changed=build.rs");

    // Which halves to generate. Mirrors nornir/build.rs's old
    // build_server(server) / build_client(mcp||server||viz) gate: by default
    // both are on (the leaf serves producer + consumer); a consumer that pins
    // only `client` or only `server` links only that half.
    let want_server = std::env::var_os("CARGO_FEATURE_SERVER").is_some();
    let want_client = std::env::var_os("CARGO_FEATURE_CLIENT").is_some();

    let fds = protox::compile(["proto/nornir.proto"], ["proto"])
        .expect("protox: compile nornir.proto");

    tonic_prost_build::configure()
        .build_server(want_server)
        .build_client(want_client)
        .compile_fds(fds)
        .expect("tonic-build: codegen");
}