chore: separated modules in a cargo workspace

This commit is contained in:
əlemi 2023-04-21 18:47:10 +02:00
parent e892b81513
commit 107c4673ef
17 changed files with 41 additions and 31 deletions

View file

@ -1,25 +1,13 @@
[workspace]
members = ["client/nvim", "server"]
[package] [package]
name = "codemp" name = "codemp"
version = "0.2.0" version = "0.2.0"
edition = "2021" edition = "2021"
# [features]
# default = ["nvim"]
# nvim = []
[lib] [lib]
name = "codemp" name = "codemp"
path = "src/lib/lib.rs"
[[bin]] # Bin to run the CodeMP gRPC server
name = "server"
path = "src/server/main.rs"
required-features = ["server"]
[[bin]]
name = "client-nvim"
path = "src/client/nvim/main.rs"
required-features = ["nvim"]
[dependencies] [dependencies]
# core # core
@ -29,27 +17,12 @@ prost = "0.11.8"
md5 = "0.7.0" md5 = "0.7.0"
uuid = { version = "1.3.1", features = ["v4"] } uuid = { version = "1.3.1", features = ["v4"] }
operational-transform = { version = "0.6", features = ["serde"] } operational-transform = { version = "0.6", features = ["serde"] }
# can these be optional?
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync", "full"], optional = false } tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync", "full"], optional = false }
tokio-stream = { version = "0.1", optional = false } tokio-stream = { version = "0.1", optional = false }
serde = { version = "1", optional = false } serde = { version = "1", optional = false }
serde_json = { version = "1", optional = false } serde_json = { version = "1", optional = false }
# runtime
# logs
tracing-subscriber = { version = "0.3", optional = true } tracing-subscriber = { version = "0.3", optional = true }
# nvim
rmpv = { version = "1", optional = true }
clap = { version = "4.2.1", features = ["derive"], optional = true }
nvim-rs = { version = "0.5", features = ["use_tokio"], optional = true }
similar = { version = "2.2", features = ["inline"] } similar = { version = "2.2", features = ["inline"] }
[build-dependencies] [build-dependencies]
tonic-build = "0.9" tonic-build = "0.9"
[features]
default = []
logs = ["dep:tracing-subscriber"]
# runtime = ["dep:tokio", "dep:tokio-stream"]
# serde = ["dep:serde", "dep:serde_json"]
server = ["logs", "dep:clap"]
nvim = ["logs", "dep:nvim-rs", "dep:clap", "dep:rmpv"]

18
client/nvim/Cargo.toml Normal file
View file

@ -0,0 +1,18 @@
[package]
name = "codemp-nvim"
version = "0.2.0"
edition = "2021"
[dependencies]
codemp = { path = "../.." }
tracing = "0.1"
tracing-subscriber = "0.3"
uuid = { version = "1.3.1", features = ["v4"] }
operational-transform = { version = "0.6", features = ["serde"] }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync", "full"] }
serde = "1"
serde_json = "1"
rmpv = "1"
clap = { version = "4.2.1", features = ["derive"] }
nvim-rs = { version = "0.5", features = ["use_tokio"] }
async-trait = "0.1.68"

View file

@ -41,7 +41,7 @@ impl NeovimHandler {
} }
} }
#[tonic::async_trait] #[async_trait::async_trait]
impl Handler for NeovimHandler { impl Handler for NeovimHandler {
type Writer = Compat<Stdout>; type Writer = Compat<Stdout>;

19
server/Cargo.toml Normal file
View file

@ -0,0 +1,19 @@
[package]
name = "codemp-server"
version = "0.2.0"
edition = "2021"
[dependencies]
codemp = { path = ".." }
tracing = "0.1"
tracing-subscriber = "0.3"
tonic = { version = "0.9", features = ["tls", "tls-roots"] }
prost = "0.11.8"
md5 = "0.7.0"
uuid = { version = "1.3.1", features = ["v4"] }
operational-transform = { version = "0.6", features = ["serde"] }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync", "full"] }
tokio-stream = "0.1"
serde = "1"
serde_json = "1"
clap = { version = "4.2.1", features = ["derive"] }