strike48-proto 0.2.2

Protobuf definitions for the Strike48 platform
Documentation
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let proto_dir = "proto";
    let proto_path = format!("{proto_dir}/connector_service.proto");

    tonic_build::configure()
        .build_server(false)
        .build_client(true)
        .protoc_arg("--experimental_allow_proto3_optional")
        .type_attribute(".", "#[allow(clippy::large_enum_variant)]")
        .compile(&[&proto_path], &[proto_dir])?;

    // Post-process generated code to fix duplicate connect method conflict
    let out_dir = std::env::var("OUT_DIR")?;
    let generated_file = format!("{out_dir}/matrix.connectors.v1.rs");

    if std::path::Path::new(&generated_file).exists() {
        let content = std::fs::read_to_string(&generated_file)?;
        let fixed = content.replace(
            "pub async fn connect<D>(dst: D)",
            "pub async fn connect_endpoint<D>(dst: D)",
        );
        std::fs::write(&generated_file, fixed)?;
    }

    Ok(())
}