aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/path_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-05 00:50:47 +0900
committernsfisis <nsfisis@gmail.com>2026-06-05 00:51:23 +0900
commitc5bcf222f98d13b104231713bf4a0aa0833c420a (patch)
treea32a484ccb9d944d44db32b229691e5c60bb5159 /crates/shirabe/src/downloader/path_downloader.rs
parent20d665bb1247500d514f05b160d01f5f8e223a38 (diff)
downloadphp-shirabe-c5bcf222f98d13b104231713bf4a0aa0833c420a.tar.gz
php-shirabe-c5bcf222f98d13b104231713bf4a0aa0833c420a.tar.zst
php-shirabe-c5bcf222f98d13b104231713bf4a0aa0833c420a.zip
feat(downloader): wire VcsDownloader subclasses via shared downloaders
Share downloaders as Rc<RefCell<dyn DownloaderInterface>> in DownloadManager and make DownloaderInterface/VcsDownloader take &mut self, matching PHP's mutable-by-reference downloader objects. This lets Git/Svn/Hg/Fossil/Perforce implement VcsDownloader and route download/install/update/prepare/cleanup through the trait instead of todo!(), and wires the as_* downcast hooks end-to-end. ChangeReportInterface::get_local_changes becomes &mut self since FileDownloader downloads to a compare dir; get_commit_logs/reapply_changes gain &mut self / Result to match the concrete implementations. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/downloader/path_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/path_downloader.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs
index 3eb2a48..99d72e7 100644
--- a/crates/shirabe/src/downloader/path_downloader.rs
+++ b/crates/shirabe/src/downloader/path_downloader.rs
@@ -537,7 +537,7 @@ impl VcsCapableDownloaderInterface for PathDownloader {
impl crate::downloader::ChangeReportInterface for PathDownloader {
fn get_local_changes(
- &self,
+ &mut self,
package: PackageInterfaceHandle,
path: &str,
) -> anyhow::Result<Option<String>> {
@@ -555,7 +555,9 @@ impl DownloaderInterface for PathDownloader {
self.inner.get_installation_source()
}
- fn as_change_report_interface(&self) -> Option<&dyn crate::downloader::ChangeReportInterface> {
+ fn as_change_report_interface(
+ &mut self,
+ ) -> Option<&mut dyn crate::downloader::ChangeReportInterface> {
Some(self)
}
@@ -566,7 +568,7 @@ impl DownloaderInterface for PathDownloader {
}
async fn download(
- &self,
+ &mut self,
package: PackageInterfaceHandle,
path: &str,
prev_package: Option<PackageInterfaceHandle>,
@@ -578,7 +580,7 @@ impl DownloaderInterface for PathDownloader {
}
async fn prepare(
- &self,
+ &mut self,
r#type: &str,
package: PackageInterfaceHandle,
path: &str,
@@ -590,7 +592,7 @@ impl DownloaderInterface for PathDownloader {
}
async fn install(
- &self,
+ &mut self,
package: PackageInterfaceHandle,
path: &str,
output: bool,
@@ -599,7 +601,7 @@ impl DownloaderInterface for PathDownloader {
}
async fn update(
- &self,
+ &mut self,
initial: PackageInterfaceHandle,
target: PackageInterfaceHandle,
path: &str,
@@ -608,7 +610,7 @@ impl DownloaderInterface for PathDownloader {
}
async fn remove(
- &self,
+ &mut self,
package: PackageInterfaceHandle,
path: &str,
output: bool,
@@ -617,7 +619,7 @@ impl DownloaderInterface for PathDownloader {
}
async fn cleanup(
- &self,
+ &mut self,
r#type: &str,
package: PackageInterfaceHandle,
path: &str,