Update CocoaPods minimum version to 1.9 (#71170)
This commit is contained in:
parent
9f7e785c7b
commit
23f5fbc69d
@ -160,12 +160,6 @@ class UserMessages {
|
||||
|
||||
// Messages used in CocoaPodsValidator
|
||||
String cocoaPodsVersion(String version) => 'CocoaPods version $version';
|
||||
String cocoaPodsUninitialized(String consequence) =>
|
||||
'CocoaPods installed but not initialized.\n'
|
||||
'$consequence\n'
|
||||
'To initialize CocoaPods, run:\n'
|
||||
' pod setup\n'
|
||||
"once to finalize CocoaPods' installation.";
|
||||
String cocoaPodsMissing(String consequence, String installInstructions) =>
|
||||
'CocoaPods not installed.\n'
|
||||
'$consequence\n'
|
||||
|
@ -89,11 +89,9 @@ class CocoaPods {
|
||||
_processManager = processManager,
|
||||
_xcodeProjectInterpreter = xcodeProjectInterpreter,
|
||||
_logger = logger,
|
||||
_platform = platform,
|
||||
_artifacts = artifacts,
|
||||
_usage = usage,
|
||||
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
|
||||
_fileSystemUtils = FileSystemUtils(fileSystem: fileSystem, platform: platform),
|
||||
_operatingSystemUtils = OperatingSystemUtils(
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
@ -103,19 +101,17 @@ class CocoaPods {
|
||||
|
||||
final FileSystem _fileSystem;
|
||||
final ProcessManager _processManager;
|
||||
final FileSystemUtils _fileSystemUtils;
|
||||
final ProcessUtils _processUtils;
|
||||
final OperatingSystemUtils _operatingSystemUtils;
|
||||
final XcodeProjectInterpreter _xcodeProjectInterpreter;
|
||||
final Logger _logger;
|
||||
final Platform _platform;
|
||||
final Artifacts _artifacts;
|
||||
final Usage _usage;
|
||||
|
||||
Future<String> _versionText;
|
||||
|
||||
String get cocoaPodsMinimumVersion => '1.6.0';
|
||||
String get cocoaPodsRecommendedVersion => '1.9.0';
|
||||
String get cocoaPodsMinimumVersion => '1.9.0';
|
||||
String get cocoaPodsRecommendedVersion => '1.10.0';
|
||||
|
||||
Future<bool> get isInstalled =>
|
||||
_processUtils.exitsHappy(<String>['which', 'pod']);
|
||||
@ -157,28 +153,6 @@ class CocoaPods {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether CocoaPods ran 'pod setup' once where the costly pods' specs are
|
||||
/// cloned.
|
||||
///
|
||||
/// Versions >= 1.8.0 do not require 'pod setup' and default to a CDN instead
|
||||
/// of a locally cloned repository.
|
||||
/// See http://blog.cocoapods.org/CocoaPods-1.8.0-beta/
|
||||
///
|
||||
/// A user can override the default location via the CP_REPOS_DIR environment
|
||||
/// variable.
|
||||
///
|
||||
/// See https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/config.rb#L138
|
||||
/// for details of this variable.
|
||||
Future<bool> get isCocoaPodsInitialized async {
|
||||
final Version installedVersion = Version.parse(await cocoaPodsVersionText);
|
||||
if (installedVersion != null && installedVersion >= Version.parse('1.8.0')) {
|
||||
return true;
|
||||
}
|
||||
final String cocoapodsReposDir = _platform.environment['CP_REPOS_DIR']
|
||||
?? _fileSystem.path.join(_fileSystemUtils.homeDirPath, '.cocoapods', 'repos');
|
||||
return _fileSystem.isDirectory(_fileSystem.path.join(cocoapodsReposDir, 'master'));
|
||||
}
|
||||
|
||||
Future<bool> processPods({
|
||||
@required XcodeBasedProject xcodeProject,
|
||||
@required BuildMode buildMode,
|
||||
@ -246,17 +220,6 @@ class CocoaPods {
|
||||
case CocoaPodsStatus.recommended:
|
||||
break;
|
||||
}
|
||||
if (!await isCocoaPodsInitialized) {
|
||||
_logger.printError(
|
||||
'Warning: CocoaPods installed but not initialized. Skipping pod install.\n'
|
||||
'$noCocoaPodsConsequence\n'
|
||||
'To initialize CocoaPods, run:\n'
|
||||
' pod setup\n'
|
||||
"once to finalize CocoaPods' installation.",
|
||||
emphasis: true,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -30,12 +30,7 @@ class CocoaPodsValidator extends DoctorValidator {
|
||||
|
||||
ValidationType status = ValidationType.installed;
|
||||
if (cocoaPodsStatus == CocoaPodsStatus.recommended) {
|
||||
if (await _cocoaPods.isCocoaPodsInitialized) {
|
||||
messages.add(ValidationMessage(_userMessages.cocoaPodsVersion(await _cocoaPods.cocoaPodsVersionText)));
|
||||
} else {
|
||||
status = ValidationType.partial;
|
||||
messages.add(ValidationMessage.error(_userMessages.cocoaPodsUninitialized(noCocoaPodsConsequence)));
|
||||
}
|
||||
messages.add(ValidationMessage(_userMessages.cocoaPodsVersion(await _cocoaPods.cocoaPodsVersionText)));
|
||||
} else {
|
||||
if (cocoaPodsStatus == CocoaPodsStatus.notInstalled) {
|
||||
status = ValidationType.missing;
|
||||
|
@ -80,7 +80,7 @@ void main() {
|
||||
xcodeProjectInterpreter: mockXcodeProjectInterpreter,
|
||||
usage: usage,
|
||||
);
|
||||
pretendPodVersionIs('1.9.0');
|
||||
pretendPodVersionIs('1.10.0');
|
||||
fileSystem.file(fileSystem.path.join(
|
||||
Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-ios-objc',
|
||||
))
|
||||
@ -177,33 +177,27 @@ void main() {
|
||||
|
||||
testWithoutContext('detects below minimum version', () async {
|
||||
pretendPodIsInstalled();
|
||||
pretendPodVersionIs('1.5.0');
|
||||
pretendPodVersionIs('1.6.0');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.belowMinimumVersion);
|
||||
});
|
||||
|
||||
testWithoutContext('detects below recommended version', () async {
|
||||
pretendPodIsInstalled();
|
||||
pretendPodVersionIs('1.6.0');
|
||||
pretendPodVersionIs('1.9.0');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.belowRecommendedVersion);
|
||||
});
|
||||
|
||||
testWithoutContext('detects at recommended version', () async {
|
||||
pretendPodIsInstalled();
|
||||
pretendPodVersionIs('1.9.0');
|
||||
pretendPodVersionIs('1.10.0');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.recommended);
|
||||
});
|
||||
|
||||
testWithoutContext('detects above recommended version', () async {
|
||||
pretendPodIsInstalled();
|
||||
pretendPodVersionIs('1.9.1');
|
||||
pretendPodVersionIs('1.10.1');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.recommended);
|
||||
});
|
||||
|
||||
testWithoutContext('detects initialized over 1.8.0', () async {
|
||||
pretendPodIsInstalled();
|
||||
pretendPodVersionIs('1.8.0');
|
||||
expect(await cocoaPodsUnderTest.isCocoaPodsInitialized, isTrue);
|
||||
});
|
||||
});
|
||||
|
||||
group('Setup Podfile', () {
|
||||
|
@ -18,7 +18,6 @@ void main() {
|
||||
cocoaPods = MockCocoaPods();
|
||||
when(cocoaPods.evaluateCocoaPodsInstallation)
|
||||
.thenAnswer((_) async => CocoaPodsStatus.recommended);
|
||||
when(cocoaPods.isCocoaPodsInitialized).thenAnswer((_) async => true);
|
||||
when(cocoaPods.cocoaPodsVersionText).thenAnswer((_) async => '1.8.0');
|
||||
});
|
||||
|
||||
@ -44,13 +43,6 @@ void main() {
|
||||
expect(result.type, ValidationType.partial);
|
||||
});
|
||||
|
||||
testWithoutContext('Emits partial status when CocoaPods is not initialized', () async {
|
||||
when(cocoaPods.isCocoaPodsInitialized).thenAnswer((_) async => false);
|
||||
final CocoaPodsValidator workflow = CocoaPodsValidator(cocoaPods, UserMessages());
|
||||
final ValidationResult result = await workflow.validate();
|
||||
expect(result.type, ValidationType.partial);
|
||||
});
|
||||
|
||||
testWithoutContext('Emits partial status when CocoaPods version is too low', () async {
|
||||
when(cocoaPods.evaluateCocoaPodsInstallation)
|
||||
.thenAnswer((_) async => CocoaPodsStatus.belowRecommendedVersion);
|
||||
|
Loading…
x
Reference in New Issue
Block a user