build.rs 681 Bytes
Newer Older
1
2
3
4
fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Only regenerate if the proto file changes
    println!("cargo:rerun-if-changed=src/proto/sglang_scheduler.proto");

5
6
    // Configure tonic-prost-build for gRPC code generation
    tonic_prost_build::configure()
7
8
9
        // Generate both client and server code
        .build_server(true)
        .build_client(true)
10
        // Allow proto3 optional fields
11
        .protoc_arg("--experimental_allow_proto3_optional")
12
13
        // Compile the proto file
        .compile_protos(&["src/proto/sglang_scheduler.proto"], &["src/proto"])?;
14
15
16
17
18

    println!("cargo:warning=Protobuf compilation completed successfully");

    Ok(())
}