mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
refactor(heap,index): compile test and bench support only for tests and benches (#5491)
`ide_heap::testing` (~430 lines of `.hprof` fixture builders) and `ide_index::bench_support` (`SyntheticIndex`) were `#[doc(hidden)] pub mod`s, so they were compiled into the desktop app and `openidea-server` and were part of the public API of both crates. Only tests and benches use them. They are now behind a `testing` feature (`ide-heap`) and a `bench-support` feature (`ide-index`), plus `cfg(test)` for in-crate tests. This follows what `ide-ssh` already does. `bench-support` is named for what it holds: a bench-only builder, not shared test fixtures. Co-authored-by: Mr0Bread <55754540+Mr0Bread@users.noreply.github.com>
This commit is contained in:
Generated
+2
@@ -4432,6 +4432,7 @@ version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
"ide-heap",
|
||||
"libc",
|
||||
"memmap2",
|
||||
"proptest",
|
||||
@@ -4547,6 +4548,7 @@ dependencies = [
|
||||
"dunce",
|
||||
"globset",
|
||||
"ide-core",
|
||||
"ide-index",
|
||||
"ide-language",
|
||||
"ignore",
|
||||
"nucleo-matcher",
|
||||
|
||||
@@ -18,7 +18,13 @@ uuid.workspace = true
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[features]
|
||||
# `testing`: the `.hprof` fixture builders, for tests and benches of this crate and of crates built on it.
|
||||
testing = []
|
||||
|
||||
[dev-dependencies]
|
||||
# Self dev-dependency: turns `testing` on for this crate's benches, so a plain `cargo bench -p ide-heap` builds them.
|
||||
ide-heap = { workspace = true, features = ["testing"] }
|
||||
criterion = { version = "0.5", default-features = false }
|
||||
proptest.workspace = true
|
||||
tempfile.workspace = true
|
||||
|
||||
@@ -20,7 +20,7 @@ mod strings;
|
||||
#[cfg(test)]
|
||||
mod test_index;
|
||||
/// Fixture builders shared by this crate's tests and by dependants' tests and benches; not API.
|
||||
#[doc(hidden)]
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
pub mod testing;
|
||||
|
||||
pub use analysis::{AnalyzeOptions, analyze};
|
||||
|
||||
@@ -78,6 +78,7 @@ zip.workspace = true
|
||||
quick-xml = "0.42"
|
||||
|
||||
[dev-dependencies]
|
||||
ide-heap = { workspace = true, features = ["testing"] }
|
||||
ide-ssh = { workspace = true, features = ["testing"] }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-util", "test-util"] }
|
||||
criterion = { version = "0.5", default-features = false }
|
||||
|
||||
@@ -24,7 +24,13 @@ postcard = { version = "1.1", default-features = false, features = ["use-std"] }
|
||||
[build-dependencies]
|
||||
blake3.workspace = true
|
||||
|
||||
[features]
|
||||
# `bench-support`: a synthetic in-memory index for `benches/index.rs`.
|
||||
bench-support = []
|
||||
|
||||
[dev-dependencies]
|
||||
# Self dev-dependency: turns `bench-support` on for this crate's benches, so a plain `cargo bench -p ide-index` builds them.
|
||||
ide-index = { workspace = true, features = ["bench-support"] }
|
||||
tempfile.workspace = true
|
||||
criterion = { version = "0.5", default-features = false }
|
||||
|
||||
|
||||
@@ -536,7 +536,7 @@ impl Drop for ProjectIndex {
|
||||
mod tests;
|
||||
|
||||
/// Synthetic in-memory index for benchmarks (`benches/index.rs`); not a stable API.
|
||||
#[doc(hidden)]
|
||||
#[cfg(any(test, feature = "bench-support"))]
|
||||
pub mod bench_support {
|
||||
use super::*;
|
||||
use crate::data::{FileEntry, FileRecord, IndexData, StoredSymbol};
|
||||
|
||||
Reference in New Issue
Block a user