diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-07 10:32:26 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-07 10:34:37 +0900 |
| commit | e1053c6881da1bba409a16783e01a89248507a66 (patch) | |
| tree | 17da41e7fe48b675434338e41e5ecefcff5894db /crates/shirabe/src/package | |
| parent | 971824aa15334fd12d08ae0f441f6bf6079344c3 (diff) | |
| download | php-shirabe-e1053c6881da1bba409a16783e01a89248507a66.tar.gz php-shirabe-e1053c6881da1bba409a16783e01a89248507a66.tar.zst php-shirabe-e1053c6881da1bba409a16783e01a89248507a66.zip | |
refactor(phase-c): share PlatformRepository and RepositorySet via handles
PHP shares a single PlatformRepository by reference across the RepositorySet,
createRequest, VersionSelector, and (in show) the installed repository. The
port worked with owned values / &mut, so it could not share: create_repository_set
silently dropped the platform repo from the pool (PlatformRepository is not
Clone), show rebuilt a fresh PlatformRepository per use, and the package
discovery / show version selectors were stubbed because VersionSelector wanted
an owned RepositorySet.
Thread the existing PlatformRepositoryHandle (Rc<RefCell<PlatformRepository>>)
through installer.rs and show, restoring the RootPackageRepository + platform
repo registration and implementing same_repository via RepositoryInterfaceHandle
ptr_eq. Hold package-discovery repos as a shared RepositoryInterfaceHandle, and
share RepositorySet as Rc<RefCell<RepositorySet>> in the set caches and
VersionSelector (which only reads it), unblocking both stubbed selector sites
and dropping show's placeholder set.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package')
| -rw-r--r-- | crates/shirabe/src/package/version/version_selector.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/shirabe/src/package/version/version_selector.rs b/crates/shirabe/src/package/version/version_selector.rs index ecf08b5..d4ce4c1 100644 --- a/crates/shirabe/src/package/version/version_selector.rs +++ b/crates/shirabe/src/package/version/version_selector.rs @@ -28,14 +28,14 @@ use crate::repository::RepositorySet; #[derive(Debug)] pub struct VersionSelector { - repository_set: RepositorySet, + repository_set: std::rc::Rc<std::cell::RefCell<RepositorySet>>, platform_constraints: IndexMap<String, Vec<AnyConstraint>>, parser: Option<VersionParser>, } impl VersionSelector { pub fn new( - repository_set: RepositorySet, + repository_set: std::rc::Rc<std::cell::RefCell<RepositorySet>>, platform_repo: Option<&mut crate::repository::PlatformRepository>, ) -> anyhow::Result<Self> { let mut platform_constraints: IndexMap<String, Vec<AnyConstraint>> = IndexMap::new(); @@ -90,7 +90,7 @@ impl VersionSelector { Some(v) => Some(self.get_parser().parse_constraints(v)?), None => None, }; - let mut candidates = self.repository_set.find_packages( + let mut candidates = self.repository_set.borrow().find_packages( &strtolower(package_name), constraint.as_ref().map(|c| c.clone()), repo_set_flags, |
