aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/installer
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/installer')
-rw-r--r--crates/shirabe/src/installer/installation_manager.rs98
-rw-r--r--crates/shirabe/src/installer/installer_interface.rs9
-rw-r--r--crates/shirabe/src/installer/library_installer.rs84
-rw-r--r--crates/shirabe/src/installer/metapackage_installer.rs40
-rw-r--r--crates/shirabe/src/installer/noop_installer.rs25
-rw-r--r--crates/shirabe/src/installer/plugin_installer.rs13
-rw-r--r--crates/shirabe/src/installer/project_installer.rs14
7 files changed, 167 insertions, 116 deletions
diff --git a/crates/shirabe/src/installer/installation_manager.rs b/crates/shirabe/src/installer/installation_manager.rs
index 7a05324..3e455b4 100644
--- a/crates/shirabe/src/installer/installation_manager.rs
+++ b/crates/shirabe/src/installer/installation_manager.rs
@@ -23,8 +23,8 @@ use crate::installer::PackageEvents;
use crate::installer::PluginInstaller;
use crate::io::ConsoleIO;
use crate::io::IOInterface;
-use crate::package::AliasPackage;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use crate::util::Platform;
use crate::util::r#loop::Loop;
@@ -37,7 +37,7 @@ pub struct InstallationManager {
/// @var array<string, InstallerInterface>
cache: IndexMap<String, Box<dyn InstallerInterface>>,
/// @var array<string, array<PackageInterface>>
- notifiable_packages: IndexMap<String, Vec<Box<dyn PackageInterface>>>,
+ notifiable_packages: IndexMap<String, Vec<PackageInterfaceHandle>>,
loop_: std::rc::Rc<std::cell::RefCell<Loop>>,
io: Box<dyn IOInterface>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
@@ -133,18 +133,19 @@ impl InstallationManager {
pub fn is_package_installed(
&mut self,
repo: &dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<bool> {
- // TODO(phase-b): $package instanceof AliasPackage downcast
- let package_as_alias: Option<&AliasPackage> = None;
- if let Some(alias) = package_as_alias {
- return Ok(repo.has_package(package)
- && self.is_package_installed(repo, alias.get_alias_of())?);
+ if let Some(alias) = package.as_alias() {
+ let alias_of: PackageInterfaceHandle = alias.get_alias_of().into();
+ return Ok(
+ repo.has_package(package.as_rc().borrow().as_package_interface())
+ && self.is_package_installed(repo, &alias_of)?,
+ );
}
Ok(self
- .get_installer(package.get_type())?
- .is_installed(repo, package))
+ .get_installer(&package.get_type())?
+ .is_installed(repo, package.as_rc().borrow().as_package_interface()))
}
/// Install binary for the given package.
@@ -311,9 +312,10 @@ impl InstallationManager {
let update_op: Option<&UpdateOperation> = None;
if op_type == "update" {
// @var UpdateOperation $operation
- if let Some(u) = update_op {
- package = u.get_target_package();
- initial_package = Some(u.get_initial_package());
+ if let Some(_u) = update_op {
+ // TODO(phase-c): bridge UpdateOperation handles (target/initial) into the
+ // &dyn PackageInterface that the installer APIs still expect.
+ continue;
} else {
continue;
}
@@ -451,9 +453,10 @@ impl InstallationManager {
let initial_package: Option<&dyn PackageInterface>;
let update_op: Option<&UpdateOperation> = None;
if op_type == "update" {
- if let Some(u) = update_op {
- package = u.get_target_package();
- initial_package = Some(u.get_initial_package());
+ if let Some(_u) = update_op {
+ // TODO(phase-c): bridge UpdateOperation handles (target/initial) into the
+ // &dyn PackageInterface that the installer APIs still expect.
+ continue;
} else {
continue;
}
@@ -537,10 +540,11 @@ impl InstallationManager {
repo: &mut dyn InstalledRepositoryInterface,
operation: &InstallOperation,
) -> Option<PhpMixed> {
- let package = operation.get_package();
- let installer = self.get_installer(package.get_type()).ok()?;
- let promise = installer.install(repo, package).await.ok()?;
- self.mark_for_notification(package);
+ let package = operation.get_package().clone();
+ let package_type = package.get_type();
+ let installer = self.get_installer(&package_type).ok()?;
+ let promise = installer.install(repo, &package).await.ok()?;
+ self.mark_for_notification(&package);
promise
}
@@ -553,27 +557,27 @@ impl InstallationManager {
repo: &mut dyn InstalledRepositoryInterface,
operation: &UpdateOperation,
) -> Option<PhpMixed> {
- let initial = operation.get_initial_package();
- let target = operation.get_target_package();
+ let initial = operation.get_initial_package().clone();
+ let target = operation.get_target_package().clone();
let initial_type = initial.get_type();
let target_type = target.get_type();
let promise = if initial_type == target_type {
- let installer = self.get_installer(initial_type).ok()?;
- let promise = installer.update(repo, initial, target).await.ok()?;
- self.mark_for_notification(target);
+ let installer = self.get_installer(&initial_type).ok()?;
+ let promise = installer.update(repo, &initial, &target).await.ok()?;
+ self.mark_for_notification(&target);
promise
} else {
// PHP: uninstall initial, then install target via the target-type installer.
let _ = self
- .get_installer(initial_type)
+ .get_installer(&initial_type)
.ok()?
- .uninstall(repo, initial)
+ .uninstall(repo, &initial)
.await
.ok()?;
- let installer = self.get_installer(target_type).ok()?;
- installer.install(repo, target).await.ok()?
+ let installer = self.get_installer(&target_type).ok()?;
+ installer.install(repo, &target).await.ok()?
};
promise
@@ -587,10 +591,11 @@ impl InstallationManager {
repo: &mut dyn InstalledRepositoryInterface,
operation: &UninstallOperation,
) -> Option<PhpMixed> {
- let package = operation.get_package();
- let installer = self.get_installer(package.get_type()).ok()?;
+ let package = operation.get_package().clone();
+ let package_type = package.get_type();
+ let installer = self.get_installer(&package_type).ok()?;
- installer.uninstall(repo, package).await.ok()?
+ installer.uninstall(repo, &package).await.ok()?
}
/// Executes markAliasInstalled operation.
@@ -602,7 +607,10 @@ impl InstallationManager {
let package = operation.get_package();
if !repo.has_package(package) {
- repo.add_package(package.clone_package_box());
+ // TODO(phase-c): MarkAliasInstalledOperation::get_package() yields a borrowed
+ // &AliasPackage; add_package now wants a shared PackageInterfaceHandle.
+ let package_handle: PackageInterfaceHandle = todo!();
+ repo.add_package(package_handle);
}
}
@@ -638,17 +646,11 @@ impl InstallationManager {
// non-batch API, deprecated
if str_contains(repo_url, "%package%") {
for package in packages {
- let url = str_replace("%package%", package.get_pretty_name(), repo_url);
+ let url = str_replace("%package%", &package.get_pretty_name(), repo_url);
let mut params: IndexMap<String, String> = IndexMap::new();
- params.insert(
- "version".to_string(),
- package.get_pretty_version().to_string(),
- );
- params.insert(
- "version_normalized".to_string(),
- package.get_version().to_string(),
- );
+ params.insert("version".to_string(), package.get_pretty_version());
+ params.insert("version_normalized".to_string(), package.get_version());
let mut opts: IndexMap<String, PhpMixed> = IndexMap::new();
opts.insert("retry-auth-failure".to_string(), PhpMixed::Bool(false));
let mut http: IndexMap<String, PhpMixed> = IndexMap::new();
@@ -693,15 +695,15 @@ impl InstallationManager {
let mut package_notification: IndexMap<String, PhpMixed> = IndexMap::new();
package_notification.insert(
"name".to_string(),
- PhpMixed::String(package.get_pretty_name().to_string()),
+ PhpMixed::String(package.get_pretty_name()),
);
package_notification.insert(
"version".to_string(),
- PhpMixed::String(package.get_version().to_string()),
+ PhpMixed::String(package.get_version()),
);
if strpos(repo_url, "packagist.org/").is_some() {
if let Some(metadata) =
- FileDownloader::download_metadata().get(package.get_name())
+ FileDownloader::download_metadata().get(&package.get_name())
{
package_notification.insert("downloaded".to_string(), metadata.clone());
} else {
@@ -764,12 +766,12 @@ impl InstallationManager {
self.reset();
}
- fn mark_for_notification(&mut self, package: &dyn PackageInterface) {
+ fn mark_for_notification(&mut self, package: &PackageInterfaceHandle) {
if let Some(notification_url) = package.get_notification_url() {
self.notifiable_packages
- .entry(notification_url.to_string())
+ .entry(notification_url)
.or_insert_with(Vec::new)
- .push(package.clone_package_box());
+ .push(package.clone());
}
}
diff --git a/crates/shirabe/src/installer/installer_interface.rs b/crates/shirabe/src/installer/installer_interface.rs
index bb510b8..8ab7efd 100644
--- a/crates/shirabe/src/installer/installer_interface.rs
+++ b/crates/shirabe/src/installer/installer_interface.rs
@@ -1,6 +1,7 @@
//! ref: composer/src/Composer/Installer/InstallerInterface.php
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use shirabe_php_shim::PhpMixed;
@@ -30,20 +31,20 @@ pub trait InstallerInterface: std::fmt::Debug {
async fn install(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>>;
async fn update(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- initial: &dyn PackageInterface,
- target: &dyn PackageInterface,
+ initial: &PackageInterfaceHandle,
+ target: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>>;
async fn uninstall(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>>;
async fn cleanup(
diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs
index 29cb455..332bdea 100644
--- a/crates/shirabe/src/installer/library_installer.rs
+++ b/crates/shirabe/src/installer/library_installer.rs
@@ -16,6 +16,7 @@ use crate::installer::BinaryPresenceInterface;
use crate::installer::InstallerInterface;
use crate::io::IOInterface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use crate::util::Filesystem;
use crate::util::Platform;
@@ -305,24 +306,36 @@ impl InstallerInterface for LibraryInstaller {
async fn install(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
// TODO(phase-b): initialize_vendor_dir requires &mut self
// self.initialize_vendor_dir();
- let download_path = self.get_install_path(package).unwrap();
+ let download_path = self
+ .get_install_path(package.as_rc().borrow().as_package_interface())
+ .unwrap();
// remove the binaries if it appears the package files are missing
- if !Filesystem::is_readable(&download_path) && repo.has_package(package) {
- self.binary_installer.remove_binaries(package);
+ if !Filesystem::is_readable(&download_path)
+ && repo.has_package(package.as_rc().borrow().as_package_interface())
+ {
+ self.binary_installer
+ .remove_binaries(package.as_rc().borrow().as_package_interface());
}
- let _ = self.install_code(package).await?;
+ let _ = self
+ .install_code(package.as_rc().borrow().as_package_interface())
+ .await?;
- let install_path = self.get_install_path(package).unwrap();
- self.binary_installer
- .install_binaries(package, &install_path, true);
- if !repo.has_package(package) {
- repo.add_package(package.clone_package_box());
+ let install_path = self
+ .get_install_path(package.as_rc().borrow().as_package_interface())
+ .unwrap();
+ self.binary_installer.install_binaries(
+ package.as_rc().borrow().as_package_interface(),
+ &install_path,
+ true,
+ );
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
+ repo.add_package(package.clone());
}
Ok(None)
@@ -331,10 +344,10 @@ impl InstallerInterface for LibraryInstaller {
async fn update(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- initial: &dyn PackageInterface,
- target: &dyn PackageInterface,
+ initial: &PackageInterfaceHandle,
+ target: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
- if !repo.has_package(initial) {
+ if !repo.has_package(initial.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", initial),
code: 0,
@@ -345,15 +358,26 @@ impl InstallerInterface for LibraryInstaller {
// TODO(phase-b): initialize_vendor_dir requires &mut self
// self.initialize_vendor_dir();
- self.binary_installer.remove_binaries(initial);
- let _ = self.update_code(initial, target).await?;
-
- let install_path = self.get_install_path(target).unwrap();
self.binary_installer
- .install_binaries(target, &install_path, true);
- repo.remove_package(initial);
- if !repo.has_package(target) {
- repo.add_package(target.clone_package_box());
+ .remove_binaries(initial.as_rc().borrow().as_package_interface());
+ let _ = self
+ .update_code(
+ initial.as_rc().borrow().as_package_interface(),
+ target.as_rc().borrow().as_package_interface(),
+ )
+ .await?;
+
+ let install_path = self
+ .get_install_path(target.as_rc().borrow().as_package_interface())
+ .unwrap();
+ self.binary_installer.install_binaries(
+ target.as_rc().borrow().as_package_interface(),
+ &install_path,
+ true,
+ );
+ repo.remove_package(initial.as_rc().borrow().as_package_interface());
+ if !repo.has_package(target.as_rc().borrow().as_package_interface()) {
+ repo.add_package(target.clone());
}
Ok(None)
@@ -362,9 +386,9 @@ impl InstallerInterface for LibraryInstaller {
async fn uninstall(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
- if !repo.has_package(package) {
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", package),
code: 0,
@@ -372,13 +396,17 @@ impl InstallerInterface for LibraryInstaller {
.into());
}
- let _ = self.remove_code(package).await?;
+ let _ = self
+ .remove_code(package.as_rc().borrow().as_package_interface())
+ .await?;
- let download_path = self.get_package_base_path(package);
- self.binary_installer.remove_binaries(package);
- repo.remove_package(package);
+ let download_path =
+ self.get_package_base_path(package.as_rc().borrow().as_package_interface());
+ self.binary_installer
+ .remove_binaries(package.as_rc().borrow().as_package_interface());
+ repo.remove_package(package.as_rc().borrow().as_package_interface());
- if strpos(package.get_name(), "/").map_or(false, |pos| pos != 0) {
+ if strpos(&package.get_name(), "/").map_or(false, |pos| pos != 0) {
let package_vendor_dir = dirname(&download_path);
if is_dir(&package_vendor_dir)
&& self.filesystem.borrow().is_dir_empty(&package_vendor_dir)
diff --git a/crates/shirabe/src/installer/metapackage_installer.rs b/crates/shirabe/src/installer/metapackage_installer.rs
index 2ea9685..cda7bf0 100644
--- a/crates/shirabe/src/installer/metapackage_installer.rs
+++ b/crates/shirabe/src/installer/metapackage_installer.rs
@@ -7,6 +7,7 @@ use crate::installer::InstallerInterface;
use crate::io::IOInterface;
use crate::io::io_interface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use anyhow::Result;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
@@ -65,15 +66,18 @@ impl InstallerInterface for MetapackageInstaller {
async fn install(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
self.io.write_error3(
- &format!(" - {}", InstallOperation::format(package, false)),
+ &format!(
+ " - {}",
+ InstallOperation::format(package.as_rc().borrow().as_package_interface(), false)
+ ),
true,
io_interface::NORMAL,
);
- repo.add_package(package.clone_package_box());
+ repo.add_package(package.clone());
Ok(None)
}
@@ -81,10 +85,10 @@ impl InstallerInterface for MetapackageInstaller {
async fn update(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- initial: &dyn PackageInterface,
- target: &dyn PackageInterface,
+ initial: &PackageInterfaceHandle,
+ target: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
- if !repo.has_package(initial) {
+ if !repo.has_package(initial.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", initial),
code: 0,
@@ -93,13 +97,20 @@ impl InstallerInterface for MetapackageInstaller {
}
self.io.write_error3(
- &format!(" - {}", UpdateOperation::format(initial, target, false)),
+ &format!(
+ " - {}",
+ UpdateOperation::format(
+ initial.as_rc().borrow().as_package_interface(),
+ target.as_rc().borrow().as_package_interface(),
+ false
+ )
+ ),
true,
io_interface::NORMAL,
);
- repo.remove_package(initial);
- repo.add_package(target.clone_package_box());
+ repo.remove_package(initial.as_rc().borrow().as_package_interface());
+ repo.add_package(target.clone());
Ok(None)
}
@@ -107,9 +118,9 @@ impl InstallerInterface for MetapackageInstaller {
async fn uninstall(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
- if !repo.has_package(package) {
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", package),
code: 0,
@@ -118,12 +129,15 @@ impl InstallerInterface for MetapackageInstaller {
}
self.io.write_error3(
- &format!(" - {}", UninstallOperation::format(package, false)),
+ &format!(
+ " - {}",
+ UninstallOperation::format(package.as_rc().borrow().as_package_interface(), false)
+ ),
true,
io_interface::NORMAL,
);
- repo.remove_package(package);
+ repo.remove_package(package.as_rc().borrow().as_package_interface());
Ok(None)
}
diff --git a/crates/shirabe/src/installer/noop_installer.rs b/crates/shirabe/src/installer/noop_installer.rs
index 8297165..12e7e95 100644
--- a/crates/shirabe/src/installer/noop_installer.rs
+++ b/crates/shirabe/src/installer/noop_installer.rs
@@ -2,6 +2,7 @@
use crate::installer::InstallerInterface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
@@ -51,10 +52,10 @@ impl InstallerInterface for NoopInstaller {
async fn install(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
- if !repo.has_package(package) {
- repo.add_package(package.clone_package_box());
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
+ repo.add_package(package.clone());
}
Ok(None)
@@ -63,10 +64,10 @@ impl InstallerInterface for NoopInstaller {
async fn update(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- initial: &dyn PackageInterface,
- target: &dyn PackageInterface,
+ initial: &PackageInterfaceHandle,
+ target: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
- if !repo.has_package(initial) {
+ if !repo.has_package(initial.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", initial),
code: 0,
@@ -74,9 +75,9 @@ impl InstallerInterface for NoopInstaller {
.into());
}
- repo.remove_package(initial);
- if !repo.has_package(target) {
- repo.add_package(target.clone_package_box());
+ repo.remove_package(initial.as_rc().borrow().as_package_interface());
+ if !repo.has_package(target.as_rc().borrow().as_package_interface()) {
+ repo.add_package(target.clone());
}
Ok(None)
@@ -85,16 +86,16 @@ impl InstallerInterface for NoopInstaller {
async fn uninstall(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
- if !repo.has_package(package) {
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", package),
code: 0,
}
.into());
}
- repo.remove_package(package);
+ repo.remove_package(package.as_rc().borrow().as_package_interface());
Ok(None)
}
diff --git a/crates/shirabe/src/installer/plugin_installer.rs b/crates/shirabe/src/installer/plugin_installer.rs
index a540677..2135bb3 100644
--- a/crates/shirabe/src/installer/plugin_installer.rs
+++ b/crates/shirabe/src/installer/plugin_installer.rs
@@ -6,6 +6,7 @@ use crate::installer::InstallerInterface;
use crate::installer::LibraryInstaller;
use crate::io::IOInterface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::plugin::PluginManager;
use crate::repository::InstalledRepositoryInterface;
use crate::util::Filesystem;
@@ -45,7 +46,7 @@ impl PluginInstaller {
&mut self,
e: anyhow::Error,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<()> {
self.inner.io.write_error(&format!(
"Plugin initialization failed ({}), uninstalling plugin",
@@ -123,7 +124,7 @@ impl InstallerInterface for PluginInstaller {
async fn install(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
self.inner.install(repo, package).await?;
@@ -137,8 +138,8 @@ impl InstallerInterface for PluginInstaller {
async fn update(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- initial: &dyn PackageInterface,
- target: &dyn PackageInterface,
+ initial: &PackageInterfaceHandle,
+ target: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
self.inner.update(repo, initial, target).await?;
@@ -153,12 +154,12 @@ impl InstallerInterface for PluginInstaller {
async fn uninstall(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> Result<Option<PhpMixed>> {
// TODO(plugin): uninstall package from plugin manager
self.get_plugin_manager()
.borrow_mut()
- .uninstall_package(package);
+ .uninstall_package(package.as_rc().borrow().as_package_interface());
self.inner.uninstall(repo, package).await
}
diff --git a/crates/shirabe/src/installer/project_installer.rs b/crates/shirabe/src/installer/project_installer.rs
index 8960854..129810b 100644
--- a/crates/shirabe/src/installer/project_installer.rs
+++ b/crates/shirabe/src/installer/project_installer.rs
@@ -3,6 +3,7 @@
use crate::downloader::DownloadManager;
use crate::installer::InstallerInterface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use crate::util::Filesystem;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
@@ -95,19 +96,22 @@ impl InstallerInterface for ProjectInstaller {
async fn install(
&mut self,
_repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
self.download_manager
.borrow()
- .install(package, &self.install_path)
+ .install(
+ package.as_rc().borrow().as_package_interface(),
+ &self.install_path,
+ )
.await
}
async fn update(
&mut self,
_repo: &mut dyn InstalledRepositoryInterface,
- _initial: &dyn PackageInterface,
- _target: &dyn PackageInterface,
+ _initial: &PackageInterfaceHandle,
+ _target: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
Err(InvalidArgumentException {
message: "not supported".to_string(),
@@ -119,7 +123,7 @@ impl InstallerInterface for ProjectInstaller {
async fn uninstall(
&mut self,
_repo: &mut dyn InstalledRepositoryInterface,
- _package: &dyn PackageInterface,
+ _package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
Err(InvalidArgumentException {
message: "not supported".to_string(),