codemp-proto/build.rs
alemi 403200d6bc
feat: slim down
reduce tonic features, add feature flags to compile only server, client,
both or neither
2024-09-30 23:51:33 +02:00

34 lines
778 B
Rust

fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = {
#[cfg(feature = "server")] { true }
#[cfg(not(feature = "server"))] { false }
};
let client = {
#[cfg(feature = "client")] { true }
#[cfg(not(feature = "client"))] { false }
};
let transport = {
#[cfg(any(feature = "server", feature = "client"))] { true }
#[cfg(not(any(feature = "server", feature = "client")))] { false }
};
Ok
(tonic_build::configure()
.build_server(server)
.build_client(client)
.build_transport(transport)
.compile_protos(
&[
"proto/common.proto",
"proto/cursor.proto",
"proto/files.proto",
"proto/auth.proto",
"proto/session.proto",
"proto/workspace.proto",
"proto/buffer.proto",
],
&["proto"],
)?)
}