aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-22 04:19:14 +0900
committernsfisis <nsfisis@gmail.com>2026-05-22 04:19:25 +0900
commit2a1696906344cb4da768a940bf8b1f89bbc82b47 (patch)
tree9e37f93baaa9858037ab3a25b13a676f07ccb3a9 /crates/shirabe/src/downloader
parent6739da8a8e271a82d1bf8ca79bba58640ae6e743 (diff)
downloadphp-shirabe-2a1696906344cb4da768a940bf8b1f89bbc82b47.tar.gz
php-shirabe-2a1696906344cb4da768a940bf8b1f89bbc82b47.tar.zst
php-shirabe-2a1696906344cb4da768a940bf8b1f89bbc82b47.zip
refactor: share Pool via Rc<RefCell>
Convert Pool to Rc<RefCell<Pool>> so Solver, Decisions, and RuleSetGenerator share it, resolving the todo!() placeholders that blocked the dependency resolver (Phase C shared ownership). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/downloader')
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs12
-rw-r--r--crates/shirabe/src/downloader/git_downloader.rs6
-rw-r--r--crates/shirabe/src/downloader/gzip_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/path_downloader.rs6
-rw-r--r--crates/shirabe/src/downloader/perforce_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/phar_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/rar_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/svn_downloader.rs16
-rw-r--r--crates/shirabe/src/downloader/tar_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/vcs_downloader.rs4
-rw-r--r--crates/shirabe/src/downloader/xz_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/zip_downloader.rs2
12 files changed, 29 insertions, 29 deletions
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index 4d33370..ce5d275 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -65,7 +65,7 @@ pub struct FileDownloader {
/// @var Filesystem
pub(crate) filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
/// @var ?Cache
- pub(crate) cache: Option<Cache>,
+ pub(crate) cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
/// @var ?EventDispatcher
pub(crate) event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
/// @var ProcessExecutor
@@ -93,7 +93,7 @@ impl FileDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
process: Option<std::rc::Rc<std::cell::RefCell<ProcessExecutor>>>,
) -> Self {
@@ -104,7 +104,7 @@ impl FileDownloader {
});
let filesystem = filesystem.unwrap_or_else(|| {
std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(Some(
- std::rc::Rc::clone(&process),
+ process.clone(),
))))
});
@@ -120,10 +120,10 @@ impl FileDownloader {
additional_cleanup_paths: IndexMap::new(),
};
- if this.cache.is_some() && this.cache.as_ref().unwrap().gc_is_necessary() {
+ if this.cache.is_some() && this.cache.as_ref().unwrap().borrow().gc_is_necessary() {
// PHP: writeError('Running cache garbage collection', true, io_interface::VERY_VERBOSE)
this.io.write_error("Running cache garbage collection");
- this.cache.as_mut().unwrap().gc(
+ this.cache.as_ref().unwrap().borrow_mut().gc(
this.config
.borrow_mut()
.get("cache-files-ttl")
@@ -496,7 +496,7 @@ impl FileDownloader {
.get(package.get_name())
.unwrap()
.clone();
- self.cache.as_mut().unwrap().remove(&key);
+ self.cache.as_ref().unwrap().borrow_mut().remove(&key);
self.last_cache_writes.shift_remove(package.get_name());
}
}
diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs
index 668a5e9..9c4c64d 100644
--- a/crates/shirabe/src/downloader/git_downloader.rs
+++ b/crates/shirabe/src/downloader/git_downloader.rs
@@ -45,9 +45,9 @@ impl GitDownloader {
let inner = VcsDownloaderBase::new(io, config, process, fs);
let git_util = GitUtil::new(
inner.io.clone_box(),
- std::rc::Rc::clone(&inner.config),
- std::rc::Rc::clone(&inner.process),
- std::rc::Rc::clone(&inner.filesystem),
+ inner.config.clone(),
+ inner.process.clone(),
+ inner.filesystem.clone(),
);
Self {
inner,
diff --git a/crates/shirabe/src/downloader/gzip_downloader.rs b/crates/shirabe/src/downloader/gzip_downloader.rs
index 9a6a258..557fe3a 100644
--- a/crates/shirabe/src/downloader/gzip_downloader.rs
+++ b/crates/shirabe/src/downloader/gzip_downloader.rs
@@ -32,7 +32,7 @@ impl GzipDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> Self {
diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs
index 126b521..9003e81 100644
--- a/crates/shirabe/src/downloader/path_downloader.rs
+++ b/crates/shirabe/src/downloader/path_downloader.rs
@@ -44,7 +44,7 @@ impl PathDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> Self {
@@ -389,8 +389,8 @@ impl PathDownloader {
let path = Filesystem::trim_trailing_slash(path);
let parser = VersionParser::new();
let mut guesser = VersionGuesser::new(
- std::rc::Rc::clone(&self.inner.config),
- std::rc::Rc::clone(&self.inner.process),
+ self.inner.config.clone(),
+ self.inner.process.clone(),
parser.clone(),
Some(self.inner.io.clone_box()),
);
diff --git a/crates/shirabe/src/downloader/perforce_downloader.rs b/crates/shirabe/src/downloader/perforce_downloader.rs
index 02e32b4..433ae8f 100644
--- a/crates/shirabe/src/downloader/perforce_downloader.rs
+++ b/crates/shirabe/src/downloader/perforce_downloader.rs
@@ -103,7 +103,7 @@ impl PerforceDownloader {
repo_config.unwrap_or_default(),
url,
path,
- std::rc::Rc::clone(&self.inner.process),
+ self.inner.process.clone(),
self.inner.io.clone_box(),
));
}
diff --git a/crates/shirabe/src/downloader/phar_downloader.rs b/crates/shirabe/src/downloader/phar_downloader.rs
index c805bb3..ee87bd1 100644
--- a/crates/shirabe/src/downloader/phar_downloader.rs
+++ b/crates/shirabe/src/downloader/phar_downloader.rs
@@ -28,7 +28,7 @@ impl PharDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> Self {
diff --git a/crates/shirabe/src/downloader/rar_downloader.rs b/crates/shirabe/src/downloader/rar_downloader.rs
index d798664..fd45c7d 100644
--- a/crates/shirabe/src/downloader/rar_downloader.rs
+++ b/crates/shirabe/src/downloader/rar_downloader.rs
@@ -31,7 +31,7 @@ impl RarDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> Self {
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs
index 56eb891..fc5bca7 100644
--- a/crates/shirabe/src/downloader/svn_downloader.rs
+++ b/crates/shirabe/src/downloader/svn_downloader.rs
@@ -47,8 +47,8 @@ impl SvnDownloader {
let mut util = SvnUtil::new(
url.to_string(),
self.inner.io.clone_box(),
- std::rc::Rc::clone(&self.inner.config),
- Some(std::rc::Rc::clone(&self.inner.process)),
+ self.inner.config.clone(),
+ Some(self.inner.process.clone()),
);
if util.binary_version().is_none() {
return Err(RuntimeException {
@@ -129,8 +129,8 @@ impl SvnDownloader {
let mut util = SvnUtil::new(
url.to_string(),
self.inner.io.clone_box(),
- std::rc::Rc::clone(&self.inner.config),
- Some(std::rc::Rc::clone(&self.inner.process)),
+ self.inner.config.clone(),
+ Some(self.inner.process.clone()),
);
let mut flags: Vec<String> = vec![];
if version_compare(&util.binary_version().unwrap_or_default(), "1.7.0", ">=") {
@@ -189,8 +189,8 @@ impl SvnDownloader {
let mut util = SvnUtil::new(
base_url.to_string(),
self.inner.io.clone_box(),
- std::rc::Rc::clone(&self.inner.config),
- Some(std::rc::Rc::clone(&self.inner.process)),
+ self.inner.config.clone(),
+ Some(self.inner.process.clone()),
);
util.set_cache_credentials(self.cache_credentials);
util.execute(command, url, cwd, path, self.inner.io.is_verbose())
@@ -384,8 +384,8 @@ impl SvnDownloader {
let mut util = SvnUtil::new(
base_url,
self.inner.io.clone_box(),
- std::rc::Rc::clone(&self.inner.config),
- Some(std::rc::Rc::clone(&self.inner.process)),
+ self.inner.config.clone(),
+ Some(self.inner.process.clone()),
);
util.set_cache_credentials(self.cache_credentials);
util.execute_local(command.clone(), path, None, self.inner.io.is_verbose())
diff --git a/crates/shirabe/src/downloader/tar_downloader.rs b/crates/shirabe/src/downloader/tar_downloader.rs
index a21e94d..b98b274 100644
--- a/crates/shirabe/src/downloader/tar_downloader.rs
+++ b/crates/shirabe/src/downloader/tar_downloader.rs
@@ -28,7 +28,7 @@ impl TarDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> Self {
diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs
index 1f041bd..31f4c7c 100644
--- a/crates/shirabe/src/downloader/vcs_downloader.rs
+++ b/crates/shirabe/src/downloader/vcs_downloader.rs
@@ -447,8 +447,8 @@ pub trait VcsDownloader:
fn get_vcs_reference(&self, package: &dyn PackageInterface, path: &str) -> Option<String> {
let parser = VersionParser::new();
let guesser = VersionGuesser::new(
- std::rc::Rc::clone(self.config()),
- std::rc::Rc::clone(self.process()),
+ self.config().clone(),
+ self.process().clone(),
parser.clone(),
Some(self.io().clone_box()),
);
diff --git a/crates/shirabe/src/downloader/xz_downloader.rs b/crates/shirabe/src/downloader/xz_downloader.rs
index e90b263..7724e9a 100644
--- a/crates/shirabe/src/downloader/xz_downloader.rs
+++ b/crates/shirabe/src/downloader/xz_downloader.rs
@@ -27,7 +27,7 @@ impl XzDownloader {
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
- cache: Option<Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> Self {
diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs
index 7cd5000..c51a9ea 100644
--- a/crates/shirabe/src/downloader/zip_downloader.rs
+++ b/crates/shirabe/src/downloader/zip_downloader.rs
@@ -39,7 +39,7 @@ impl ZipDownloader {
event_dispatcher: Option<
std::rc::Rc<std::cell::RefCell<crate::event_dispatcher::EventDispatcher>>,
>,
- cache: Option<crate::cache::Cache>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<crate::cache::Cache>>>,
filesystem: std::rc::Rc<std::cell::RefCell<crate::util::Filesystem>>,
process: std::rc::Rc<std::cell::RefCell<crate::util::ProcessExecutor>>,
) -> Self {