mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[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:
parent
68fa653e59
commit
563fb0c743
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user