[SwiftPM] Simplify logic that determines if CocoaPods is used (#158409)

This is a refactoring with no semantic changes. I will get a text exemption.

Part of https://github.com/flutter/flutter/issues/151567
This commit is contained in:
Loïc Sharma 2024-11-11 13:03:30 -08:00 committed by GitHub
parent 68fa653e59
commit 563fb0c743
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,11 +90,7 @@ class DarwinDependencyManagement {
final bool useCocoapods; final bool useCocoapods;
if (_project.usesSwiftPackageManager) { if (_project.usesSwiftPackageManager) {
useCocoapods = _usingCocoaPodsPlugin( useCocoapods = swiftPackageCount < totalCount;
pluginCount: totalCount,
swiftPackageCount: swiftPackageCount,
cocoapodCount: podCount,
);
} else { } else {
// When Swift Package Manager is not enabled, set up Podfile if plugins // When Swift Package Manager is not enabled, set up Podfile if plugins
// is not empty, regardless of if plugins are CocoaPod compatible. This // is not empty, regardless of if plugins are CocoaPod compatible. This
@ -112,19 +108,6 @@ class DarwinDependencyManagement {
} }
} }
bool _usingCocoaPodsPlugin({
required int pluginCount,
required int swiftPackageCount,
required int cocoapodCount,
}) {
if (_project.usesSwiftPackageManager) {
if (pluginCount == swiftPackageCount) {
return false;
}
}
return cocoapodCount > 0;
}
/// Returns count of total number of plugins, number of Swift Package Manager /// Returns count of total number of plugins, number of Swift Package Manager
/// compatible plugins, and number of CocoaPods compatible plugins. A plugin /// compatible plugins, and number of CocoaPods compatible plugins. A plugin
/// can be both Swift Package Manager and CocoaPods compatible. /// can be both Swift Package Manager and CocoaPods compatible.