aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-registry/src/repository/mod.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-02 17:21:29 +0900
committernsfisis <nsfisis@gmail.com>2026-05-02 17:21:29 +0900
commit43efd895d24b7ccd2853fa5bcf08ad0e621f33ce (patch)
tree6caa14192cb2c753b9699bc3c5d62fe334920718 /crates/mozart-registry/src/repository/mod.rs
parent5b767cdd832d39816ee4c2dbf94274c0130dd572 (diff)
downloadphp-mozart-43efd895d24b7ccd2853fa5bcf08ad0e621f33ce.tar.gz
php-mozart-43efd895d24b7ccd2853fa5bcf08ad0e621f33ce.tar.zst
php-mozart-43efd895d24b7ccd2853fa5bcf08ad0e621f33ce.zip
refactor(registry): plumb RepositorySet and executor through callers
ResolveRequest and LockFileGenerationRequest now take Arc<RepositorySet> instead of a raw Cache. install_from_lock now accepts &mut dyn InstallerExecutor instead of constructing FilesystemExecutor internally. Both changes expose the DI injection points needed by the upcoming in-process test harness, where Packagist must be replaced with an empty RepositorySet (Composer's `'packagist' => false` test config) and filesystem install execution must be replaced with a tracing recorder (Composer's InstallationManagerMock). The eager VCS scan and inline-package preload still happen inside resolve(), so the RawRepository array is kept on ResolveRequest as raw_repositories - migrating those through RepositorySet remains a follow-up. RepositorySet gains with_packagist and empty constructors so production callers and future tests have a uniform construction shape. All 136 enabled installer fixtures + 114 mozart-registry tests + 541 mozart lib tests still green; clippy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-registry/src/repository/mod.rs')
-rw-r--r--crates/mozart-registry/src/repository/mod.rs16
1 files changed, 16 insertions, 0 deletions
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()
}