8000 Update CocoaPods minimum version to 1.9 by jmagman · Pull Request #71170 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update CocoaPods minimum version to 1.9 #71170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/flutter_tools/lib/src/base/user_messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
41 changes: 2 additions & 39 deletions packages/flutter_tools/lib/src/macos/cocoapods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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']);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -246,17 +220,6 @@ class CocoaPods {
case CocoaPodsStatu 8000 s.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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also delete this user message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that, good eye.

}
messages.add(ValidationMessage(_userMessages.cocoaPodsVersion(await _cocoaPods.cocoaPodsVersionText)));
} else {
if (cocoaPodsStatus == CocoaPodsStatus.notInstalled) {
status = ValidationType.missing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
))
Expand Down Expand Up @@ -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', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand All @@ -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);
Expand Down
0