build: make lsp dependency graph optional

This commit is contained in:
Dandaedre 2026-09-29 21:24:11 +02:00
parent 5c133e24c3
commit bee9367360
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
5 changed files with 14 additions and 7 deletions

View File

@ -23,25 +23,27 @@ path = "src/bin/john-slop-fmt.rs"
[[bin]]
name = "john-slop-lsp"
path = "src/bin/john-slop-lsp.rs"
required-features = ["lsp"]
[features]
default = ["fancy-diagnostics"]
default = ["fancy-diagnostics", "lsp"]
fancy-diagnostics = ["miette/fancy"]
lsp = ["dep:john-slop-lsp-engine", "dep:tokio", "dep:tower-lsp-server"]
[dependencies]
clap = { version = "4.6.7", default-features = false, features = ["derive", "error-context", "help", "std", "suggestions", "usage"] }
globset = { version = "0.4.20", default-features = false }
john-slop-core = { path = "crates/john-slop-core" }
john-slop-lsp-engine = { package = "john-slop-lsp", path = "crates/john-slop-lsp" }
john-slop-lsp-engine = { package = "john-slop-lsp", path = "crates/john-slop-lsp", optional = true }
miette = { version = "7.6.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.151"
similar = "2.7.0"
tempfile = "3.27.0"
thiserror = "2.0.21"
tokio = { version = "1.53.1", default-features = false, features = ["io-std", "macros", "rt-multi-thread", "sync"] }
tokio = { version = "1.53.1", default-features = false, features = ["io-std", "macros", "rt-multi-thread", "sync"], optional = true }
toml = "1.1.6"
tower-lsp-server = { version = "0.23.0", default-features = false, features = ["runtime-tokio"] }
tower-lsp-server = { version = "0.23.0", default-features = false, features = ["runtime-tokio"], optional = true }
[dev-dependencies]
criterion = { version = "0.8.2", default-features = false }

View File

@ -21,8 +21,10 @@ cargo deny --locked check
```
The default `fancy-diagnostics` feature enables the detector's colored Miette
renderer and default output mode. The no-default-features test run ensures the
shared library and all binaries remain valid with the plain fallback. Focused
renderer and default output mode. The default `lsp` feature exposes the
compatibility facade's protocol module and builds the LSP binary. The
no-default-features test run exercises the core, detector, and formatter without
the async protocol dependency graph and with the plain diagnostic fallback. Focused
unit and integration tests cover domain invariants, input failures, archives,
CLI exit behavior, and feature configurations.

View File

@ -8,7 +8,7 @@ edition = "2024"
cargo-fuzz = true
[dependencies]
john_slop = { path = "..", default-features = false }
john_slop = { path = "..", default-features = false, features = ["lsp"] }
libfuzzer-sys = "0.4.13"
tempfile = "3.27.0"
toml = "1.1.6"

View File

@ -3,4 +3,5 @@
#![warn(missing_docs)]
pub use john_slop_core::*;
#[cfg(feature = "lsp")]
pub use john_slop_lsp_engine as lsp;

View File

@ -1,3 +1,5 @@
#![cfg(feature = "lsp")]
use std::{fs, ops::Range as ByteRange, path::PathBuf};
use futures::{FutureExt, StreamExt};