// common/build.rs

use std::{env, fs, path::PathBuf};

fn main() {
    tonic_build::configure()
        .build_server(true)
        .build_client(true)
        .compile_protos(&["proto/lesavka.proto"], &["proto"])
        .expect("prost build failed");

    let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR"));
    fs::write(
        out_dir.join("lesavka_wrapped.rs"),
        r#"include!("lesavka.rs");
"#,
    )
    .expect("write lesavka wrapper");
}
