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/binary_installer.rs5
-rw-r--r--crates/shirabe/src/installer/installation_manager.rs5
-rw-r--r--crates/shirabe/src/installer/installer_event.rs8
-rw-r--r--crates/shirabe/src/installer/library_installer.rs4
-rw-r--r--crates/shirabe/src/installer/metapackage_installer.rs5
-rw-r--r--crates/shirabe/src/installer/package_event.rs8
-rw-r--r--crates/shirabe/src/installer/plugin_installer.rs3
-rw-r--r--crates/shirabe/src/installer/suggested_packages_reporter.rs5
8 files changed, 24 insertions, 19 deletions
diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs
index 54e1143..a555d83 100644
--- a/crates/shirabe/src/installer/binary_installer.rs
+++ b/crates/shirabe/src/installer/binary_installer.rs
@@ -10,6 +10,7 @@ use shirabe_php_shim::{
};
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::package::PackageInterface;
use crate::util::Filesystem;
use crate::util::Platform;
@@ -21,14 +22,14 @@ use crate::util::Silencer;
pub struct BinaryInstaller {
pub(crate) bin_dir: String,
pub(crate) bin_compat: String,
- pub(crate) io: Box<dyn IOInterface>,
+ pub(crate) io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
pub(crate) filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
vendor_dir: Option<String>,
}
impl BinaryInstaller {
pub fn new(
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
bin_dir: String,
bin_compat: String,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
diff --git a/crates/shirabe/src/installer/installation_manager.rs b/crates/shirabe/src/installer/installation_manager.rs
index 3e455b4..5f312b6 100644
--- a/crates/shirabe/src/installer/installation_manager.rs
+++ b/crates/shirabe/src/installer/installation_manager.rs
@@ -23,6 +23,7 @@ use crate::installer::PackageEvents;
use crate::installer::PluginInstaller;
use crate::io::ConsoleIO;
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::package::PackageInterface;
use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
@@ -39,7 +40,7 @@ pub struct InstallationManager {
/// @var array<string, array<PackageInterface>>
notifiable_packages: IndexMap<String, Vec<PackageInterfaceHandle>>,
loop_: std::rc::Rc<std::cell::RefCell<Loop>>,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
output_progress: bool,
}
@@ -47,7 +48,7 @@ pub struct InstallationManager {
impl InstallationManager {
pub fn new(
loop_: std::rc::Rc<std::cell::RefCell<Loop>>,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
) -> Self {
Self {
diff --git a/crates/shirabe/src/installer/installer_event.rs b/crates/shirabe/src/installer/installer_event.rs
index 3c02b7f..5adde1c 100644
--- a/crates/shirabe/src/installer/installer_event.rs
+++ b/crates/shirabe/src/installer/installer_event.rs
@@ -9,7 +9,7 @@ use crate::io::IOInterface;
pub struct InstallerEvent {
inner: Event,
composer: ComposerWeakHandle,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
dev_mode: bool,
execute_operations: bool,
transaction: Transaction,
@@ -19,7 +19,7 @@ impl InstallerEvent {
pub fn new(
event_name: String,
composer: ComposerWeakHandle,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
dev_mode: bool,
execute_operations: bool,
transaction: Transaction,
@@ -39,8 +39,8 @@ impl InstallerEvent {
&self.composer
}
- pub fn get_io(&self) -> &dyn IOInterface {
- self.io.as_ref()
+ pub fn get_io(&self) -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ self.io.clone()
}
pub fn is_dev_mode(&self) -> bool {
diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs
index 332bdea..17ec8d4 100644
--- a/crates/shirabe/src/installer/library_installer.rs
+++ b/crates/shirabe/src/installer/library_installer.rs
@@ -28,7 +28,7 @@ pub struct LibraryInstaller {
pub(crate) composer: PartialComposerWeakHandle,
pub(crate) vendor_dir: String,
pub(crate) download_manager: Option<std::rc::Rc<std::cell::RefCell<DownloadManager>>>,
- pub(crate) io: Box<dyn IOInterface>,
+ pub(crate) io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
pub(crate) r#type: Option<String>,
pub(crate) filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
pub(crate) binary_installer: BinaryInstaller,
@@ -37,7 +37,7 @@ pub struct LibraryInstaller {
impl LibraryInstaller {
/// Initializes library installer.
pub fn new(
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
composer: PartialComposerWeakHandle,
r#type: Option<String>,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
diff --git a/crates/shirabe/src/installer/metapackage_installer.rs b/crates/shirabe/src/installer/metapackage_installer.rs
index cda7bf0..fe41dd3 100644
--- a/crates/shirabe/src/installer/metapackage_installer.rs
+++ b/crates/shirabe/src/installer/metapackage_installer.rs
@@ -5,6 +5,7 @@ use crate::dependency_resolver::operation::UninstallOperation;
use crate::dependency_resolver::operation::UpdateOperation;
use crate::installer::InstallerInterface;
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
use crate::package::PackageInterface;
use crate::package::PackageInterfaceHandle;
@@ -14,11 +15,11 @@ use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
#[derive(Debug)]
pub struct MetapackageInstaller {
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
}
impl MetapackageInstaller {
- pub fn new(io: Box<dyn IOInterface>) -> Self {
+ pub fn new(io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>) -> Self {
Self { io }
}
}
diff --git a/crates/shirabe/src/installer/package_event.rs b/crates/shirabe/src/installer/package_event.rs
index d0aecc8..342732d 100644
--- a/crates/shirabe/src/installer/package_event.rs
+++ b/crates/shirabe/src/installer/package_event.rs
@@ -11,7 +11,7 @@ use indexmap::IndexMap;
pub struct PackageEvent {
inner: Event,
composer: ComposerWeakHandle,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
dev_mode: bool,
local_repo: Box<dyn RepositoryInterface>,
operations: Vec<Box<dyn OperationInterface>>,
@@ -22,7 +22,7 @@ impl PackageEvent {
pub fn new(
event_name: String,
composer: ComposerWeakHandle,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
dev_mode: bool,
local_repo: Box<dyn RepositoryInterface>,
operations: Vec<Box<dyn OperationInterface>>,
@@ -47,8 +47,8 @@ impl PackageEvent {
&self.composer
}
- pub fn get_io(&self) -> &dyn IOInterface {
- self.io.as_ref()
+ pub fn get_io(&self) -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ self.io.clone()
}
pub fn is_dev_mode(&self) -> bool {
diff --git a/crates/shirabe/src/installer/plugin_installer.rs b/crates/shirabe/src/installer/plugin_installer.rs
index 2135bb3..deadcb7 100644
--- a/crates/shirabe/src/installer/plugin_installer.rs
+++ b/crates/shirabe/src/installer/plugin_installer.rs
@@ -5,6 +5,7 @@ use crate::installer::BinaryInstaller;
use crate::installer::InstallerInterface;
use crate::installer::LibraryInstaller;
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::package::PackageInterface;
use crate::package::PackageInterfaceHandle;
use crate::plugin::PluginManager;
@@ -21,7 +22,7 @@ pub struct PluginInstaller {
impl PluginInstaller {
pub fn new(
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
composer: PartialComposerWeakHandle,
fs: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
binary_installer: Option<BinaryInstaller>,
diff --git a/crates/shirabe/src/installer/suggested_packages_reporter.rs b/crates/shirabe/src/installer/suggested_packages_reporter.rs
index fc4165a..8faae9c 100644
--- a/crates/shirabe/src/installer/suggested_packages_reporter.rs
+++ b/crates/shirabe/src/installer/suggested_packages_reporter.rs
@@ -1,6 +1,7 @@
//! ref: composer/src/Composer/Installer/SuggestedPackagesReporter.php
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::package::PackageInterface;
use crate::repository::InstalledRepository;
use crate::repository::RepositoryInterface;
@@ -11,7 +12,7 @@ use shirabe_external_packages::symfony::component::console::formatter::OutputFor
#[derive(Debug)]
pub struct SuggestedPackagesReporter {
suggested_packages: Vec<IndexMap<String, String>>,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
}
impl SuggestedPackagesReporter {
@@ -19,7 +20,7 @@ impl SuggestedPackagesReporter {
pub const MODE_BY_PACKAGE: i64 = 2;
pub const MODE_BY_SUGGESTION: i64 = 4;
- pub fn new(io: Box<dyn IOInterface>) -> Self {
+ pub fn new(io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>) -> Self {
Self {
suggested_packages: Vec::new(),
io,