diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-02 18:04:29 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-02 18:04:29 +0900 |
| commit | 33fe16285acbed1f5146c2d746eba2295bd57688 (patch) | |
| tree | 0df8f83fd9e95e87406e350ce48816451b6d07af /crates/mozart/src/commands/remove.rs | |
| parent | 82501a36a0fa6725d656742da42c860e75a89b89 (diff) | |
| parent | c446337e75ba9fd674dd63d56ec25d7bd5b5fa31 (diff) | |
| download | php-mozart-33fe16285acbed1f5146c2d746eba2295bd57688.tar.gz php-mozart-33fe16285acbed1f5146c2d746eba2295bd57688.tar.zst php-mozart-33fe16285acbed1f5146c2d746eba2295bd57688.zip | |
Merge branch 'test/di'
Diffstat (limited to 'crates/mozart/src/commands/remove.rs')
| -rw-r--r-- | crates/mozart/src/commands/remove.rs | 76 |
1 files changed, 54 insertions, 22 deletions
diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs index 7afa51d..e499af0 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, @@ -444,9 +452,9 @@ pub async fn execute( apcu_autoloader_prefix: args.apcu_autoloader_prefix.clone(), download_only: false, prefer_source: false, - no_cache: cli.no_cache, }, console, + &mut executor, ) .await?; } @@ -505,9 +513,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 +572,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 +584,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, @@ -589,9 +605,9 @@ async fn remove_unused( apcu_autoloader_prefix: args.apcu_autoloader_prefix.clone(), download_only: false, prefer_source: false, - no_cache, }, console, + &mut executor, ) .await?; } @@ -838,12 +854,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 +873,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 +905,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 +926,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 |
