diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-22 01:29:48 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-22 01:43:48 +0900 |
| commit | 0b06f54103490e3ce5658e82bbc0119633e26cd8 (patch) | |
| tree | 687b075131d3679725e77e0931ff7c503a6c3034 /crates/shirabe/src/util | |
| parent | 2914770fba6b3cc03a68fae493f60470a41962ec (diff) | |
| download | php-shirabe-0b06f54103490e3ce5658e82bbc0119633e26cd8.tar.gz php-shirabe-0b06f54103490e3ce5658e82bbc0119633e26cd8.tar.zst php-shirabe-0b06f54103490e3ce5658e82bbc0119633e26cd8.zip | |
refactor(composer): unify Composer/PartialComposer via Rc handles
Model PHP's `Composer extends PartialComposer` as a PartialOrFullComposer
enum and merge partial_composer.rs into composer.rs. Introduce
ComposerHandle / PartialComposerHandle (plus their Weak variants) so the
graph can be shared, and build it at once with Rc::new_cyclic in the
factory to resolve the back-reference cycles.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util')
| -rw-r--r-- | crates/shirabe/src/util/http_downloader.rs | 7 | ||||
| -rw-r--r-- | crates/shirabe/src/util/stream_context_factory.rs | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 8c8b8ef..b5a4923 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -14,7 +14,8 @@ use shirabe_php_shim::{ }; use shirabe_semver::constraint::Constraint; -use crate::composer::Composer; +use crate::composer; +use crate::composer::ComposerHandle; use crate::config::Config; use crate::downloader::TransportException; use crate::exception::IrrecoverableDownloadException; @@ -595,7 +596,7 @@ impl HttpDownloader { .parse_constraints(versions_value.as_string().unwrap_or(""))?; let composer_constraint = Constraint::new( "==", - &version_parser.normalize(&Composer::get_version(), None)?, + &version_parser.normalize(&composer::get_version(), None)?, ); if !constraint.matches(&composer_constraint) { continue; @@ -633,7 +634,7 @@ impl HttpDownloader { )?; let composer_constraint = Constraint::new( "==", - &version_parser.normalize(&Composer::get_version(), None)?, + &version_parser.normalize(&composer::get_version(), None)?, ); if !constraint.matches(&composer_constraint) { continue; diff --git a/crates/shirabe/src/util/stream_context_factory.rs b/crates/shirabe/src/util/stream_context_factory.rs index bb1948e..48949c8 100644 --- a/crates/shirabe/src/util/stream_context_factory.rs +++ b/crates/shirabe/src/util/stream_context_factory.rs @@ -9,7 +9,8 @@ use shirabe_php_shim::{ php_uname, stream_context_create, stripos, uasort, }; -use crate::composer::Composer; +use crate::composer; +use crate::composer::ComposerHandle; use crate::downloader::TransportException; use crate::repository::PlatformRepository; use crate::util::Filesystem; @@ -203,7 +204,7 @@ impl StreamContextFactory { let platform_php_version = PlatformRepository::get_platform_php_version(); let user_agent = format!( "User-Agent: Composer/{} ({os}; {release}; {php_version}; {http_version}{platform}{ci})", - Composer::get_version(), + composer::get_version(), os = if function_exists("php_uname") { php_uname("s") } else { |
