mirror of
https://github.com/hexedtech/codemp-proto.git
synced 2024-11-23 07:54:49 +01:00
feat: slim down
reduce tonic features, add feature flags to compile only server, client, both or neither
This commit is contained in:
parent
1474c378bc
commit
403200d6bc
2 changed files with 40 additions and 15 deletions
11
Cargo.toml
11
Cargo.toml
|
@ -10,7 +10,7 @@ authors = [
|
||||||
"cschen <cschen@codemp.dev>"
|
"cschen <cschen@codemp.dev>"
|
||||||
]
|
]
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -18,8 +18,13 @@ name = "codemp_proto"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
prost = "0.13"
|
prost = "0.13"
|
||||||
tonic = "0.12"
|
uuid = "1.10"
|
||||||
uuid = "1.7"
|
tonic = { version = "0.12", default-features = false, features = ["codegen", "prost"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tonic-build = "0.12"
|
tonic-build = "0.12"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["client"]
|
||||||
|
client = []
|
||||||
|
server = []
|
||||||
|
|
44
build.rs
44
build.rs
|
@ -1,14 +1,34 @@
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
Ok(tonic_build::configure().compile(
|
let server = {
|
||||||
&[
|
#[cfg(feature = "server")] { true }
|
||||||
"proto/common.proto",
|
#[cfg(not(feature = "server"))] { false }
|
||||||
"proto/cursor.proto",
|
};
|
||||||
"proto/files.proto",
|
|
||||||
"proto/auth.proto",
|
let client = {
|
||||||
"proto/session.proto",
|
#[cfg(feature = "client")] { true }
|
||||||
"proto/workspace.proto",
|
#[cfg(not(feature = "client"))] { false }
|
||||||
"proto/buffer.proto",
|
};
|
||||||
],
|
|
||||||
&["proto"],
|
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"],
|
||||||
|
)?)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue