aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/mozart-registry/src/lockfile.rs41
-rw-r--r--crates/mozart-registry/src/repository/mod.rs16
-rw-r--r--crates/mozart-registry/src/resolver.rs58
-rw-r--r--crates/mozart/src/commands/create_project.rs15
-rw-r--r--crates/mozart/src/commands/install.rs9
-rw-r--r--crates/mozart/src/commands/remove.rs74
-rw-r--r--crates/mozart/src/commands/require.rs59
-rw-r--r--crates/mozart/src/commands/update.rs37
8 files changed, 202 insertions, 107 deletions
diff --git a/crates/mozart-registry/src/lockfile.rs b/crates/mozart-registry/src/lockfile.rs
index edda3e9..8022f8b 100644
--- a/crates/mozart-registry/src/lockfile.rs
+++ b/crates/mozart-registry/src/lockfile.rs
@@ -1,7 +1,5 @@
-use crate::cache::Cache;
use crate::packagist::{PackagistDist, PackagistSource, PackagistVersion};
-use crate::repository::packagist_repo::PackagistRepository;
-use crate::repository::{Repository, RepositorySet};
+use crate::repository::RepositorySet;
use crate::resolver::ResolvedPackage;
use mozart_core::package::{RawPackageData, to_json_pretty};
use serde::{Deserialize, Serialize};
@@ -9,18 +7,6 @@ use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
use std::fs;
use std::path::Path;
-/// Build a [`RepositorySet`] containing only [`PackagistRepository`].
-///
-/// Used by `generate_lock_file` to fetch full metadata for resolved packages
-/// not already covered by inline `type: package` repositories. Step B routes
-/// only Packagist queries through the trait; VCS/inline migration is a
-/// follow-up.
-fn build_packagist_repo_set(repo_cache: &Cache) -> RepositorySet {
- let repos: Vec<Box<dyn Repository>> =
- vec![Box::new(PackagistRepository::new(repo_cache.clone()))];
- RepositorySet::new(repos)
-}
-
fn default_stability() -> String {
"stable".to_string()
}
@@ -364,8 +350,9 @@ pub struct LockFileGenerationRequest {
pub composer_json: RawPackageData,
/// Whether require-dev was included in resolution.
pub include_dev: bool,
- /// Repo cache for Packagist API calls made during generation.
- pub repo_cache: Cache,
+ /// Repository set used to fetch full metadata for resolved packages
+ /// that aren't already covered by inline `type: package` repositories.
+ pub repositories: std::sync::Arc<RepositorySet>,
}
impl LockFileGenerationRequest {
@@ -535,7 +522,7 @@ pub async fn generate_lock_file(request: &LockFileGenerationRequest) -> anyhow::
// through `RepositorySet`, which today contains only Packagist; future
// steps will move VCS / inline through the same set.
let mut package_metadata: HashMap<String, PackagistVersion> = HashMap::new();
- let repo_set = build_packagist_repo_set(&request.repo_cache);
+ let repo_set = &request.repositories;
for pkg in &request.resolved_packages {
if let Some(inline) = request.inline_lookup(&pkg.name, &pkg.version_normalized) {
package_metadata.insert(pkg.name.clone(), inline);
@@ -1092,7 +1079,9 @@ mod tests {
composer_json_content: composer_json_content.clone(),
composer_json,
include_dev: true,
- repo_cache: Cache::new(std::env::temp_dir().join("mozart-test-cache"), false),
+ repositories: std::sync::Arc::new(RepositorySet::with_packagist(
+ crate::cache::Cache::new(std::env::temp_dir().join("mozart-test-cache"), false),
+ )),
};
let lock = generate_lock_file(&request).await.unwrap();
@@ -1180,9 +1169,11 @@ mod tests {
#[tokio::test]
#[ignore]
async fn test_generate_lock_file_monolog() {
+ use crate::cache::Cache;
use crate::resolver::PlatformConfig;
use crate::resolver::{ResolveRequest, resolve};
use mozart_core::package::Stability;
+ use std::sync::Arc;
// Resolve monolog/monolog ^3.0
let resolve_request = ResolveRequest {
@@ -1197,9 +1188,12 @@ mod tests {
platform: PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: Cache::new(std::env::temp_dir().join("mozart-test-cache"), false),
+ repositories: Arc::new(RepositorySet::with_packagist(Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ))),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let resolved = resolve(&resolve_request)
@@ -1216,7 +1210,10 @@ mod tests {
composer_json_content: composer_json_content.clone(),
composer_json,
include_dev: false,
- repo_cache: Cache::new(std::env::temp_dir().join("mozart-test-cache"), false),
+ repositories: Arc::new(RepositorySet::with_packagist(Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ))),
};
let lock = generate_lock_file(&gen_request)
diff --git a/crates/mozart-registry/src/repository/mod.rs b/crates/mozart-registry/src/repository/mod.rs
index 1ab8797..0f742a3 100644
--- a/crates/mozart-registry/src/repository/mod.rs
+++ b/crates/mozart-registry/src/repository/mod.rs
@@ -81,6 +81,22 @@ impl RepositorySet {
Self { repos }
}
+ /// Production default: a single [`packagist_repo::PackagistRepository`]
+ /// backed by the given on-disk cache. Mirrors what Composer does when
+ /// no `'packagist' => false` entry appears in the merged config.
+ pub fn with_packagist(repo_cache: crate::cache::Cache) -> Self {
+ Self::new(vec![Box::new(packagist_repo::PackagistRepository::new(
+ repo_cache,
+ ))])
+ }
+
+ /// An empty set. Mirrors Composer's `'packagist' => false` test config:
+ /// resolution proceeds entirely from packages already in the pool
+ /// (eager VCS scan, inline `type: package` repos, the locked repository).
+ pub fn empty() -> Self {
+ Self::new(Vec::new())
+ }
+
pub fn is_empty(&self) -> bool {
self.repos.is_empty()
}
diff --git a/crates/mozart-registry/src/resolver.rs b/crates/mozart-registry/src/resolver.rs
index 878dc02..336d6d7 100644
--- a/crates/mozart-registry/src/resolver.rs
+++ b/crates/mozart-registry/src/resolver.rs
@@ -6,11 +6,10 @@
use std::collections::{HashMap, HashSet};
use std::fmt;
+use std::sync::Arc;
-use crate::cache::Cache;
use crate::packagist;
-use crate::repository::packagist_repo::PackagistRepository;
-use crate::repository::{PackageQuery, Repository, RepositorySet};
+use crate::repository::{PackageQuery, RepositorySet};
use crate::vcs_bridge;
use mozart_core::package::{RawRepository, Stability};
use mozart_sat_resolver::{
@@ -348,14 +347,20 @@ pub struct ResolveRequest {
pub ignore_platform_reqs: bool,
/// Specific platform requirements to ignore.
pub ignore_platform_req_list: Vec<String>,
- /// On-disk repo cache for Packagist API responses.
- pub repo_cache: Cache,
+ /// Repository set used to fetch package metadata. Mirrors Composer's
+ /// `RepositoryManager`. Production builders construct this with a single
+ /// `PackagistRepository`; in-process test harnesses can construct one
+ /// without any HTTP-backed repos to mimic Composer's
+ /// `'packagist' => false` test config.
+ pub repositories: Arc<RepositorySet>,
/// Temporary version constraint overrides (from --with flag).
/// Maps package name (lowercase) to constraint string.
pub temporary_constraints: HashMap<String, String>,
- /// VCS repositories from composer.json "repositories" section.
- /// Used to fetch packages from VCS before falling back to Packagist.
- pub repositories: Vec<RawRepository>,
+ /// VCS / inline-package repository entries from composer.json's
+ /// `repositories` section, used by the eager VCS scan and inline-package
+ /// preload that still live in `resolve()` (Step B follow-up will move
+ /// these through `RepositorySet` too).
+ pub raw_repositories: Vec<RawRepository>,
}
/// A single package in the resolution output.
@@ -369,19 +374,6 @@ pub struct ResolvedPackage {
pub is_dev: bool,
}
-/// Build a [`RepositorySet`] containing only [`PackagistRepository`].
-///
-/// The resolver still preloads VCS and inline packages directly into the
-/// pool builder (and tracks their names in skip-lists) — Step B routes
-/// only Packagist queries through the trait. Migrating VCS/inline through
-/// `RepositorySet` is a follow-up. The function returns a single-repo set
-/// purely so the seed and transitive loops have a uniform call shape.
-fn build_packagist_repo_set(repo_cache: &Cache) -> RepositorySet {
- let repos: Vec<Box<dyn Repository>> =
- vec![Box::new(PackagistRepository::new(repo_cache.clone()))];
- RepositorySet::new(repos)
-}
-
// ─────────────────────────────────────────────────────────────────────────────
// Public resolve() function
// ─────────────────────────────────────────────────────────────────────────────
@@ -460,7 +452,7 @@ pub async fn resolve(request: &ResolveRequest) -> Result<Vec<ResolvedPackage>, R
}
// Scan VCS repositories and collect packages from them
- let vcs_packages = vcs_bridge::scan_vcs_repositories(&request.repositories).await;
+ let vcs_packages = vcs_bridge::scan_vcs_repositories(&request.raw_repositories).await;
let mut vcs_package_names: HashSet<String> = HashSet::new();
for vpkg in &vcs_packages {
vcs_package_names.insert(vpkg.name.clone());
@@ -481,7 +473,7 @@ pub async fn resolve(request: &ResolveRequest) -> Result<Vec<ResolvedPackage>, R
// Collect inline `type: package` repositories. These don't require any
// network fetch; they go straight into the pool and are also tracked by
// name so the Packagist seed/transitive loops below skip them.
- let inline_packages = crate::inline_package::collect_inline_packages(&request.repositories);
+ let inline_packages = crate::inline_package::collect_inline_packages(&request.raw_repositories);
let mut inline_package_names: HashSet<String> = HashSet::new();
for ipkg in &inline_packages {
inline_package_names.insert(ipkg.name.clone());
@@ -496,12 +488,12 @@ pub async fn resolve(request: &ResolveRequest) -> Result<Vec<ResolvedPackage>, R
}
}
- // Build the repository set used for Packagist queries (and, in future
- // steps, inline + VCS too). Today only Packagist flows through the
- // trait — VCS and inline packages above are still preloaded directly,
- // and their names go into the skip lists so we don't double-load them
- // through this set.
- let repo_set: RepositorySet = build_packagist_repo_set(&request.repo_cache);
+ // The repository set is supplied by the caller. Today production
+ // builders pass a single-Packagist set; in-process tests can pass a
+ // set with no HTTP-backed repos. VCS and inline packages above are
+ // still preloaded directly, and their names go into the skip lists so
+ // we don't double-load them through this set.
+ let repo_set: &RepositorySet = &request.repositories;
// Seed the builder with packages for root requirements.
let seed_names: Vec<String> = root_requires
@@ -993,6 +985,7 @@ mod tests {
#[tokio::test]
#[ignore]
async fn test_resolve_monolog_e2e() {
+ use crate::cache::Cache;
let request = ResolveRequest {
root_name: String::new(),
require: vec![("monolog/monolog".to_string(), "^3.0".to_string())],
@@ -1005,9 +998,12 @@ mod tests {
platform: PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: Cache::new(std::env::temp_dir().join("mozart-test-cache"), false),
+ repositories: Arc::new(RepositorySet::with_packagist(Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ))),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let result = resolve(&request).await;
diff --git a/crates/mozart/src/commands/create_project.rs b/crates/mozart/src/commands/create_project.rs
index a137868..01b337e 100644
--- a/crates/mozart/src/commands/create_project.rs
+++ b/crates/mozart/src/commands/create_project.rs
@@ -419,9 +419,11 @@ pub async fn execute(
platform: PlatformConfig::new(),
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
temporary_constraints: HashMap::new(),
- repositories: raw.repositories.clone(),
+ raw_repositories: raw.repositories.clone(),
};
console.info("Resolving dependencies...");
@@ -440,7 +442,9 @@ pub async fn execute(
composer_json_content: composer_json_content.clone(),
composer_json: raw.clone(),
include_dev: dev_mode,
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
})
.await?;
@@ -497,6 +501,10 @@ pub async fn execute(
.and_then(|v| v.as_bool())
.unwrap_or(false);
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let files_cache = mozart_registry::cache::Cache::files(&cache_config);
+ let mut executor =
+ mozart_registry::installer_executor::FilesystemExecutor::new(files_cache);
super::install::install_from_lock(
&new_lock,
&target_dir,
@@ -517,6 +525,7 @@ pub async fn execute(
no_cache: cli.no_cache,
},
console,
+ &mut executor,
)
.await?;
diff --git a/crates/mozart/src/commands/install.rs b/crates/mozart/src/commands/install.rs
index b303ade..5053783 100644
--- a/crates/mozart/src/commands/install.rs
+++ b/crates/mozart/src/commands/install.rs
@@ -422,10 +422,8 @@ pub async fn install_from_lock(
vendor_dir: &Path,
config: &InstallConfig,
console: &mozart_core::console::Console,
+ executor: &mut dyn InstallerExecutor,
) -> anyhow::Result<()> {
- let cache_config = mozart_registry::cache::build_cache_config(config.no_cache);
- let files_cache = mozart_registry::cache::Cache::files(&cache_config);
-
let dev_mode = config.dev_mode;
// Step 1: Determine which packages to install
@@ -506,7 +504,6 @@ pub async fn install_from_lock(
console.info(&console_format!(" - Would remove <info>{}</info>", name));
}
} else {
- let mut executor = FilesystemExecutor::new(files_cache);
let exec_ctx = ExecuteContext {
vendor_dir: vendor_dir.to_path_buf(),
no_progress: config.no_progress,
@@ -761,6 +758,9 @@ pub async fn execute(
let vendor_dir = working_dir.join("vendor");
// Step 7: Delegate to shared install_from_lock()
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let files_cache = mozart_registry::cache::Cache::files(&cache_config);
+ let mut executor = FilesystemExecutor::new(files_cache);
install_from_lock(
&lock,
&working_dir,
@@ -781,6 +781,7 @@ pub async fn execute(
no_cache: cli.no_cache,
},
console,
+ &mut executor,
)
.await
}
diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs
index 7afa51d..8794a10 100644
--- a/crates/mozart/src/commands/remove.rs
+++ b/crates/mozart/src/commands/remove.rs
@@ -253,9 +253,11 @@ pub async fn execute(
platform: PlatformConfig::new(),
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
temporary_constraints: HashMap::new(),
- repositories: raw.repositories.clone(),
+ raw_repositories: raw.repositories.clone(),
};
// Print header messages
@@ -346,7 +348,9 @@ pub async fn execute(
composer_json_content: composer_json_content.clone(),
composer_json: raw.clone(),
include_dev: dev_mode,
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
})
.await?;
@@ -427,6 +431,10 @@ pub async fn execute(
// Install packages (unless --no-install or --dry-run)
if !args.no_install && !args.dry_run {
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let files_cache = mozart_registry::cache::Cache::files(&cache_config);
+ let mut executor =
+ mozart_registry::installer_executor::FilesystemExecutor::new(files_cache);
super::install::install_from_lock(
&new_lock,
&working_dir,
@@ -447,6 +455,7 @@ pub async fn execute(
no_cache: cli.no_cache,
},
console,
+ &mut executor,
)
.await?;
}
@@ -505,9 +514,11 @@ async fn remove_unused(
platform: PlatformConfig::new(),
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
temporary_constraints: HashMap::new(),
- repositories: raw.repositories.clone(),
+ raw_repositories: raw.repositories.clone(),
};
console.info("Resolving dependencies to detect unused packages...");
@@ -562,7 +573,9 @@ async fn remove_unused(
composer_json_content,
composer_json: raw.clone(),
include_dev: dev_mode,
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
})
.await?;
@@ -572,6 +585,10 @@ async fn remove_unused(
// Install
if !args.no_install {
let vendor_dir = working_dir.join("vendor");
+ let cache_config = mozart_registry::cache::build_cache_config(no_cache);
+ let files_cache = mozart_registry::cache::Cache::files(&cache_config);
+ let mut executor =
+ mozart_registry::installer_executor::FilesystemExecutor::new(files_cache);
super::install::install_from_lock(
&new_lock,
working_dir,
@@ -592,6 +609,7 @@ async fn remove_unused(
no_cache,
},
console,
+ &mut executor,
)
.await?;
}
@@ -838,12 +856,16 @@ mod tests {
platform: mozart_registry::resolver::PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let resolved = resolve(&request)
.await
@@ -853,9 +875,13 @@ mod tests {
composer_json_content: content.to_string(),
composer_json: raw.clone(),
include_dev: false,
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
})
.await
@@ -881,12 +907,16 @@ mod tests {
platform: mozart_registry::resolver::PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let resolved2 = resolve(&request2)
.await
@@ -898,9 +928,13 @@ mod tests {
composer_json_content: composer_json_content2,
composer_json: raw,
include_dev: false,
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
})
.await
diff --git a/crates/mozart/src/commands/require.rs b/crates/mozart/src/commands/require.rs
index 016a536..ead632f 100644
--- a/crates/mozart/src/commands/require.rs
+++ b/crates/mozart/src/commands/require.rs
@@ -642,9 +642,11 @@ pub async fn execute(
platform: PlatformConfig::new(),
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
temporary_constraints: HashMap::new(),
- repositories: raw.repositories.clone(),
+ raw_repositories: raw.repositories.clone(),
};
// Print header messages
@@ -736,7 +738,9 @@ pub async fn execute(
composer_json_content: composer_json_content.clone(),
composer_json: raw.clone(),
include_dev: dev_mode,
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
})
.await?;
@@ -843,6 +847,10 @@ pub async fn execute(
.and_then(|v| v.as_bool())
.unwrap_or(false);
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let files_cache = mozart_registry::cache::Cache::files(&cache_config);
+ let mut executor =
+ mozart_registry::installer_executor::FilesystemExecutor::new(files_cache);
super::install::install_from_lock(
&new_lock,
&working_dir,
@@ -867,6 +875,7 @@ pub async fn execute(
no_cache: cli.no_cache,
},
console,
+ &mut executor,
)
.await?;
}
@@ -1022,12 +1031,16 @@ mod tests {
platform: PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let resolved = resolver::resolve(&request)
@@ -1041,9 +1054,13 @@ mod tests {
composer_json_content: composer_json_content.to_string(),
composer_json,
include_dev: false,
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
})
.await
@@ -1082,12 +1099,16 @@ mod tests {
platform: PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let resolved = resolver::resolve(&request)
@@ -1098,9 +1119,13 @@ mod tests {
composer_json_content: content.to_string(),
composer_json: raw,
include_dev: false,
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
})
.await
diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs
index b58155e..fd533fd 100644
--- a/crates/mozart/src/commands/update.rs
+++ b/crates/mozart/src/commands/update.rs
@@ -863,9 +863,11 @@ pub async fn execute(
platform: PlatformConfig::new(),
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
temporary_constraints,
- repositories: composer_json.repositories.clone(),
+ raw_repositories: composer_json.repositories.clone(),
};
// Step 6: Print header and run resolver
@@ -1021,7 +1023,9 @@ pub async fn execute(
composer_json_content: composer_json_content.clone(),
composer_json: composer_json.clone(),
include_dev: dev_mode,
- repo_cache: repo_cache.clone(),
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()),
+ ),
})
.await?;
@@ -1218,6 +1222,10 @@ pub async fn execute(
.map(|s| s.eq_ignore_ascii_case("source"))
.unwrap_or(false);
+ let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache);
+ let files_cache = mozart_registry::cache::Cache::files(&cache_config);
+ let mut executor =
+ mozart_registry::installer_executor::FilesystemExecutor::new(files_cache);
super::install::install_from_lock(
&new_lock,
&working_dir,
@@ -1238,6 +1246,7 @@ pub async fn execute(
no_cache: cli.no_cache,
},
console,
+ &mut executor,
)
.await?;
}
@@ -1960,12 +1969,16 @@ mod tests {
platform: PlatformConfig::new(),
ignore_platform_reqs: false,
ignore_platform_req_list: vec![],
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
temporary_constraints: HashMap::new(),
- repositories: vec![],
+ raw_repositories: vec![],
};
let resolved = resolve(&request).await.expect("Resolution should succeed");
@@ -1977,9 +1990,13 @@ mod tests {
composer_json_content: composer_json_content.to_string(),
composer_json,
include_dev: false,
- repo_cache: mozart_registry::cache::Cache::new(
- std::env::temp_dir().join("mozart-test-cache"),
- false,
+ repositories: std::sync::Arc::new(
+ mozart_registry::repository::RepositorySet::with_packagist(
+ mozart_registry::cache::Cache::new(
+ std::env::temp_dir().join("mozart-test-cache"),
+ false,
+ ),
+ ),
),
})
.await