From 446f719f6c34453f027d5ccdbf81b16e63f4c982 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 11:14:42 +0900 Subject: refactor(symfony-process): extract symfony/process into the shirabe-symfony-process crate Move `Symfony\Component\Process` out of shirabe-external-packages and into its own crate, so the path is `shirabe_symfony_process::Process` instead of `shirabe_external_packages::symfony::process::Process`. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/Cargo.toml | 1 + crates/shirabe/src/command/diagnose_command.rs | 2 +- crates/shirabe/src/console/application.rs | 2 +- crates/shirabe/src/downloader/zip_downloader.rs | 2 +- crates/shirabe/src/event_dispatcher/event_dispatcher.rs | 4 ++-- crates/shirabe/src/platform/hhvm_detector.rs | 2 +- crates/shirabe/src/util/perforce.rs | 4 ++-- crates/shirabe/src/util/process_executor.rs | 10 +++++----- crates/shirabe/tests/command/self_update_command_test.rs | 2 +- .../tests/package/archiver/archivable_files_finder_test.rs | 2 +- crates/shirabe/tests/package/archiver/archive_manager_test.rs | 2 +- crates/shirabe/tests/platform/hhvm_detector_test.rs | 2 +- crates/shirabe/tests/plugin/plugin_installer_test.rs | 2 +- 13 files changed, 19 insertions(+), 18 deletions(-) (limited to 'crates/shirabe') diff --git a/crates/shirabe/Cargo.toml b/crates/shirabe/Cargo.toml index 3ac40475..64aa14e0 100644 --- a/crates/shirabe/Cargo.toml +++ b/crates/shirabe/Cargo.toml @@ -12,6 +12,7 @@ shirabe-php-rpc.workspace = true shirabe-php-shim.workspace = true shirabe-semver.workspace = true shirabe-spdx-licenses.workspace = true +shirabe-symfony-process.workspace = true anyhow.workspace = true async-trait.workspace = true base64.workspace = true diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index 9f834315..b6b1ffad 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -36,7 +36,6 @@ use indexmap::IndexMap; use shirabe_external_packages::symfony::console::command::command::Command; use shirabe_external_packages::symfony::console::input::InputInterface; use shirabe_external_packages::symfony::console::output::OutputInterface; -use shirabe_external_packages::symfony::process::ExecutableFinder; use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ @@ -45,6 +44,7 @@ use shirabe_php_shim::{ is_string, php_regex, rtrim, str_contains, str_replace, str_starts_with, strpos, strstr, strstr3, strtolower, trim, version_compare, }; +use shirabe_symfony_process::ExecutableFinder; #[derive(Debug)] pub struct DiagnoseCommand { diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index 05cd1d22..8b60c988 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -92,7 +92,6 @@ use shirabe_external_packages::symfony::console::signal_registry::signal_registr use shirabe_external_packages::symfony::console::style::style_interface::StyleInterface; use shirabe_external_packages::symfony::console::style::symfony_style::SymfonyStyle; use shirabe_external_packages::symfony::console::terminal::Terminal; -use shirabe_external_packages::symfony::process::exception::ProcessTimedOutException; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ LogicException as ShimLogicException, PHP_VERSION, PHP_VERSION_ID, PhpMixed, RuntimeException, @@ -103,6 +102,7 @@ use shirabe_php_shim::{ php_uname, posix_getuid, random_bytes, realpath, restore_error_handler, round, str_contains, str_replace, strpos, strtoupper, sys_get_temp_dir, time, unlink, }; +use shirabe_symfony_process::exception::ProcessTimedOutException; /// The PHP `Composer\Console\Application` and `Symfony\Component\Console\Application` are /// flattened into a single struct. Methods that are overridden by subclass and called via diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs index fd7d66d3..ddbb6788 100644 --- a/crates/shirabe/src/downloader/zip_downloader.rs +++ b/crates/shirabe/src/downloader/zip_downloader.rs @@ -8,7 +8,6 @@ use crate::package::PackageInterfaceHandle; use crate::util::IniHelper; use crate::util::Platform; use indexmap::IndexMap; -use shirabe_external_packages::symfony::process::ExecutableFinder; use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ @@ -17,6 +16,7 @@ use shirabe_php_shim::{ impl_php_class, is_file, json_encode, php_regex, random_int, str_contains, str_replace, strlen, substr, version_compare, }; +use shirabe_symfony_process::ExecutableFinder; use std::sync::Mutex; static UNZIP_COMMANDS: Mutex>>> = Mutex::new(None); diff --git a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs index 4386204f..04c590c6 100644 --- a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs +++ b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs @@ -22,8 +22,6 @@ use crate::util::Platform; use crate::util::ProcessExecutor; use indexmap::IndexMap; use shirabe_external_packages::symfony::console::output::output_interface; -use shirabe_external_packages::symfony::process::ExecutableFinder; -use shirabe_external_packages::symfony::process::PhpExecutableFinder; use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_rpc::{ PhpThrow, PluginValue, RustMethodDispatcher, RustObjHandle, call_function, @@ -38,6 +36,8 @@ use shirabe_php_shim::{ str_contains, str_ends_with, str_replace, str_starts_with, strlen, strpos, strtoupper, substr, trim, }; +use shirabe_symfony_process::ExecutableFinder; +use shirabe_symfony_process::PhpExecutableFinder; /// Represents a callable listener. PHP's `callable` may be a string (command, script, or /// "Class::method"), a `[object|string, method]` pair, or a `\Closure`. diff --git a/crates/shirabe/src/platform/hhvm_detector.rs b/crates/shirabe/src/platform/hhvm_detector.rs index 69871f1f..26fb5e12 100644 --- a/crates/shirabe/src/platform/hhvm_detector.rs +++ b/crates/shirabe/src/platform/hhvm_detector.rs @@ -2,8 +2,8 @@ use crate::util::Platform; use crate::util::ProcessExecutor; -use shirabe_external_packages::symfony::process::ExecutableFinder; use shirabe_php_shim::{HHVM_VERSION, defined}; +use shirabe_symfony_process::ExecutableFinder; use std::sync::Mutex; // None = null (uninitialized), Some(None) = false (not found), Some(Some(v)) = version diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index f03e4835..1820936c 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -6,14 +6,14 @@ use crate::util::Filesystem; use crate::util::Platform; use crate::util::ProcessExecutor; use indexmap::IndexMap; -use shirabe_external_packages::symfony::process::ExecutableFinder; -use shirabe_external_packages::symfony::process::Process; use shirabe_pcre::Preg; use shirabe_php_shim::{ Exception, PHP_EOL, PhpMixed, PhpResource, chdir, date, explode, fclose, feof, fgets, file_get_contents, fopen, fwrite, gethostname, json_decode, php_regex, str_replace_array, strcmp, strlen, strpos, strrpos, substr, time, trim, }; +use shirabe_symfony_process::ExecutableFinder; +use shirabe_symfony_process::Process; /// @phpstan-type RepoConfig array{unique_perforce_client_name?: string, depot?: string, branch?: string, p4user?: string, p4password?: string} #[derive(Debug)] diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs index 2b4c0d89..56199868 100644 --- a/crates/shirabe/src/util/process_executor.rs +++ b/crates/shirabe/src/util/process_executor.rs @@ -7,11 +7,6 @@ use crate::util::GitHub; use crate::util::Platform; use indexmap::IndexMap; use shirabe_external_packages::seld::signal::SignalHandler; -use shirabe_external_packages::symfony::process::ExecutableFinder; -use shirabe_external_packages::symfony::process::Process; -use shirabe_external_packages::symfony::process::ProcessMock; -use shirabe_external_packages::symfony::process::exception::ProcessSignaledException; -use shirabe_external_packages::symfony::process::exception::RuntimeException as SymfonyProcessRuntimeException; use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ @@ -20,6 +15,11 @@ use shirabe_php_shim::{ php_regex, rtrim, str_replace, strcspn, strlen, strpbrk, strtolower, strtr_array, substr_replace, trim, }; +use shirabe_symfony_process::ExecutableFinder; +use shirabe_symfony_process::Process; +use shirabe_symfony_process::ProcessMock; +use shirabe_symfony_process::exception::ProcessSignaledException; +use shirabe_symfony_process::exception::RuntimeException as SymfonyProcessRuntimeException; use std::sync::{LazyLock, Mutex}; static EXECUTABLES: LazyLock>> = diff --git a/crates/shirabe/tests/command/self_update_command_test.rs b/crates/shirabe/tests/command/self_update_command_test.rs index 6dc64104..1f83af66 100644 --- a/crates/shirabe/tests/command/self_update_command_test.rs +++ b/crates/shirabe/tests/command/self_update_command_test.rs @@ -3,8 +3,8 @@ use crate::test_case::{RunOptions, get_application_tester, init_temp_composer}; use indexmap::IndexMap; use serial_test::serial; -use shirabe_external_packages::symfony::process::Process; use shirabe_php_shim::{PHP_BINARY, PhpMixed}; +use shirabe_symfony_process::Process; /// ref: SelfUpdateCommandTest::setUp. The `composer-test.phar` copy PHP also performs here lives in /// `set_up_with_phar` instead, so the one test that never touches the phar is not blocked by the diff --git a/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs b/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs index 2e5aa738..499e08dc 100644 --- a/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs +++ b/crates/shirabe/tests/package/archiver/archivable_files_finder_test.rs @@ -3,9 +3,9 @@ use indexmap::IndexMap; use shirabe::package::archiver::ArchivableFilesFinder; use shirabe::util::Filesystem; -use shirabe_external_packages::symfony::process::Process; use shirabe_pcre::Preg; use shirabe_php_shim::{PhpMixed, ZipArchive, dirname, file_put_contents, preg_quote}; +use shirabe_symfony_process::Process; use tempfile::TempDir; struct SetUp { diff --git a/crates/shirabe/tests/package/archiver/archive_manager_test.rs b/crates/shirabe/tests/package/archiver/archive_manager_test.rs index 84feb5bc..43e2f84a 100644 --- a/crates/shirabe/tests/package/archiver/archive_manager_test.rs +++ b/crates/shirabe/tests/package/archiver/archive_manager_test.rs @@ -12,11 +12,11 @@ use shirabe::util::Filesystem; use shirabe::util::ProcessExecutor; use shirabe::util::http_downloader::HttpDownloader; use shirabe::util::r#loop::Loop; -use shirabe_external_packages::symfony::process::Process; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ PhpMixed, file_exists, file_put_contents, realpath, sys_get_temp_dir, unlink, }; +use shirabe_symfony_process::Process; use tempfile::TempDir; // ref: ArchiverTestCase::setUp + ArchiveManagerTest::setUp. diff --git a/crates/shirabe/tests/platform/hhvm_detector_test.rs b/crates/shirabe/tests/platform/hhvm_detector_test.rs index 340bf888..ea75ec8b 100644 --- a/crates/shirabe/tests/platform/hhvm_detector_test.rs +++ b/crates/shirabe/tests/platform/hhvm_detector_test.rs @@ -4,9 +4,9 @@ use shirabe::platform::hhvm_detector::HhvmDetector; use shirabe::platform::hhvm_detector::HhvmDetectorInterface; use shirabe::util::Platform; use shirabe::util::ProcessExecutor; -use shirabe_external_packages::symfony::process::ExecutableFinder; use shirabe_php_shim::PhpMixed; use shirabe_semver::VersionParser; +use shirabe_symfony_process::ExecutableFinder; fn set_up() -> HhvmDetector { let hhvm_detector = HhvmDetector::new(None, None); diff --git a/crates/shirabe/tests/plugin/plugin_installer_test.rs b/crates/shirabe/tests/plugin/plugin_installer_test.rs index 0c82a11a..65a8872b 100644 --- a/crates/shirabe/tests/plugin/plugin_installer_test.rs +++ b/crates/shirabe/tests/plugin/plugin_installer_test.rs @@ -30,10 +30,10 @@ use shirabe::util::http_downloader::HttpDownloader; use shirabe::util::r#loop::Loop; use shirabe::util::process_executor::ProcessExecutor; use shirabe_external_packages::symfony::console::output::output_interface::VERBOSITY_NORMAL; -use shirabe_external_packages::symfony::process::PhpExecutableFinder; use shirabe_php_shim::Catch as _; use shirabe_php_shim::PhpMixed; use shirabe_semver::VersionParser; +use shirabe_symfony_process::PhpExecutableFinder; use tempfile::TempDir; /// The register/activate flow runs the plugin in the real PHP worker; without a PHP binary the -- cgit v1.3.1-4-g156e