Hi, I'm experimenting with Claude to use the new Oak infrastructure in Jarl to get diagnostics on unused objects and unused function arguments (etiennebacher/jarl#478, etiennebacher/jarl#479). I noticed that pulling oak_index also adds a lot of dependencies from oak_package_metadata and oak_sources. I'm wondering if it is possible to put these imports behind a feature flag so that I have the option to not pull all those dependencies.
I don't think this requires large changes in oak_index, see below a patch generated by Claude. Using this patch locally removed 69 dependencies from Jarl (mostly because rustls isn't imported anymore) while keeping the key features of oak_index. I know this is still early stage and WIP on your side, but I wanted to raise this early in case it influences future development. Maybe you were already planning to address this in some way.
Thanks, and I'm really curious to see the future capabilities of Oak!
Claude patch
diff --git a/crates/oak_index/Cargo.toml b/crates/oak_index/Cargo.toml
index 817e9546..d5a1399a 100644
--- a/crates/oak_index/Cargo.toml
+++ b/crates/oak_index/Cargo.toml
@@ -12,6 +12,12 @@ license.workspace = true
rust-version.workspace = true
[features]
+default = ["package_metadata"]
+# Enables the `library`, `package`, `package_definitions`, `scope_layer`, and
+# `external` modules, which model installed R packages and cross-file scope
+# resolution. Disable for lighter consumers (e.g. linters running per-file
+# semantic analysis) that don't need installed-package lookups.
+package_metadata = ["dep:oak_package_metadata", "dep:oak_sources"]
testing = ["dep:tempfile"]
[lints]
@@ -27,13 +33,19 @@ itertools.workspace = true
log.workspace = true
oak_core.workspace = true
oak_index_vec.workspace = true
-oak_package_metadata.workspace = true
-oak_sources.workspace = true
rustc-hash.workspace = true
smallvec.workspace = true
stdext.workspace = true
url.workspace = true
+[dependencies.oak_package_metadata]
+workspace = true
+optional = true
+
+[dependencies.oak_sources]
+workspace = true
+optional = true
+
[dependencies.tempfile]
workspace = true
optional = true
diff --git a/crates/oak_index/src/lib.rs b/crates/oak_index/src/lib.rs
index 94301573..9f857358 100644
--- a/crates/oak_index/src/lib.rs
+++ b/crates/oak_index/src/lib.rs
@@ -1,8 +1,13 @@
pub mod builder;
+#[cfg(feature = "package_metadata")]
pub mod external;
+#[cfg(feature = "package_metadata")]
pub mod library;
+#[cfg(feature = "package_metadata")]
pub mod package;
+#[cfg(feature = "package_metadata")]
pub mod package_definitions;
+#[cfg(feature = "package_metadata")]
pub mod scope_layer;
pub mod semantic_index;
pub mod use_def_map;
Hi, I'm experimenting with Claude to use the new Oak infrastructure in Jarl to get diagnostics on unused objects and unused function arguments (etiennebacher/jarl#478, etiennebacher/jarl#479). I noticed that pulling
oak_indexalso adds a lot of dependencies fromoak_package_metadataandoak_sources. I'm wondering if it is possible to put these imports behind a feature flag so that I have the option to not pull all those dependencies.I don't think this requires large changes in
oak_index, see below a patch generated by Claude. Using this patch locally removed 69 dependencies from Jarl (mostly becauserustlsisn't imported anymore) while keeping the key features ofoak_index. I know this is still early stage and WIP on your side, but I wanted to raise this early in case it influences future development. Maybe you were already planning to address this in some way.Thanks, and I'm really curious to see the future capabilities of Oak!
Claude patch