Skip to content

Commit 17611a9

Browse files
committed
perf(pm): thread warm project cache into resolver config
1 parent 82721ee commit 17611a9

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

crates/ruborist/src/resolver/builder.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::model::node::EdgeType;
3232
use crate::model::package_json::PackageJson;
3333
use crate::resolver::preload::{PreloadConfig, preload_manifests};
3434
use crate::resolver::registry::{ResolveError, resolve_registry_dep};
35-
use crate::service::ManifestProvider;
35+
use crate::service::{ManifestProvider, ProjectCacheData};
3636
use crate::spec::{Catalogs, PackageSpec, Protocol};
3737
use crate::traits::progress::{BuildEvent, EventReceiver, NoopReceiver};
3838
use crate::traits::registry::{RegistryClient, ResolvedPackage};
@@ -118,6 +118,8 @@ pub struct BuildDepsConfig {
118118
/// Catalog definitions for the `catalog:` dependency protocol.
119119
/// Key `""` = default catalog, other keys = named catalogs.
120120
pub catalogs: Catalogs,
121+
/// Host-provided project cache used to seed resolver manifest state.
122+
pub warm_project_cache: Option<ProjectCacheData>,
121123
}
122124

123125
impl Default for BuildDepsConfig {
@@ -130,6 +132,7 @@ impl Default for BuildDepsConfig {
130132
git_clone_cache: Arc::new(GitCloneCache::new()),
131133
http_fetch_cache: Arc::new(HttpFetchCache::new()),
132134
catalogs: HashMap::new(),
135+
warm_project_cache: None,
133136
}
134137
}
135138
}
@@ -164,6 +167,12 @@ impl BuildDepsConfig {
164167
self.catalogs = catalogs;
165168
self
166169
}
170+
171+
/// Set the host-provided warm project cache.
172+
pub fn with_warm_project_cache(mut self, warm_project_cache: Option<ProjectCacheData>) -> Self {
173+
self.warm_project_cache = warm_project_cache;
174+
self
175+
}
167176
}
168177

169178
/// Snapshot of node dependency flags to avoid borrowing conflicts.

crates/ruborist/src/service/api.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ where
239239
.with_peer_deps(peer_deps)
240240
.with_concurrency(concurrency)
241241
.with_skip_preload(skip_preload)
242-
.with_catalogs(catalogs);
242+
.with_catalogs(catalogs)
243+
.with_warm_project_cache(warm_project_cache);
243244
if let Some(dir) = cache_dir {
244245
config = config.with_cache_dir(dir);
245246
}

0 commit comments

Comments
 (0)