Skip to content

Commit

Permalink
Update minimum required version to Xcode 13 (#97746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman authored Mar 2, 2022
1 parent fdcd144 commit 8f360c9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 56 deletions.
2 changes: 1 addition & 1 deletion packages/flutter_tools/lib/src/base/user_messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class UserMessages {
String xcodeLocation(String location) => 'Xcode at $location';

String xcodeOutdated(String requiredVersion) =>
'Flutter requires a minimum Xcode version of $requiredVersion.\n'
'Flutter requires Xcode $requiredVersion or higher.\n'
'Download the latest version or update via the Mac App Store.';

String xcodeRecommended(String recommendedVersion) =>
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_tools/lib/src/macos/xcode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import '../base/version.dart';
import '../build_info.dart';
import '../ios/xcodeproj.dart';

Version get xcodeRequiredVersion => Version(12, 3, null, text: '12.3');
Version get xcodeRequiredVersion => Version(13, null, null);

/// Diverging this number from the minimum required version will provide a doctor
/// warning, not error, that users should upgrade Xcode.
Version get xcodeRecommendedVersion => Version(13, null, null, text: '13');
Version get xcodeRecommendedVersion => xcodeRequiredVersion;

/// SDK name passed to `xcrun --sdk`. Corresponds to undocumented Xcode
/// SUPPORTED_PLATFORMS values.
Expand Down
63 changes: 14 additions & 49 deletions packages/flutter_tools/test/general.shard/macos/xcode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,85 +133,50 @@ void main() {
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
});

testWithoutContext('xcodeVersionSatisfactory is false when version is less than minimum', () {
testWithoutContext('version checks fail when version is less than minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(9, 0, 0);
xcodeProjectInterpreter.version = Version(9, null, null);

expect(xcode.isRequiredVersionSatisfactory, isFalse);
});

testWithoutContext('xcodeVersionSatisfactory is false when xcodebuild tools are not installed', () {
xcodeProjectInterpreter.isInstalled = false;

expect(xcode.isRequiredVersionSatisfactory, isFalse);
});

testWithoutContext('xcodeVersionSatisfactory is true when version meets minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(12, 3, null);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
});

testWithoutContext('xcodeVersionSatisfactory is true when major version exceeds minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(13, 0, 0);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
});

testWithoutContext('xcodeVersionSatisfactory is true when minor version exceeds minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(12, 5, 0);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
});

testWithoutContext('xcodeVersionSatisfactory is true when patch version exceeds minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(12, 3, 1);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
});

testWithoutContext('isRecommendedVersionSatisfactory is false when version is less than minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(12, null, null);

expect(xcode.isRecommendedVersionSatisfactory, isFalse);
});

testWithoutContext('isRecommendedVersionSatisfactory is false when xcodebuild tools are not installed', () {
testWithoutContext('version checks fail when xcodebuild tools are not installed', () {
xcodeProjectInterpreter.isInstalled = false;

expect(xcode.isRequiredVersionSatisfactory, isFalse);
expect(xcode.isRecommendedVersionSatisfactory, isFalse);
});

testWithoutContext('isRecommendedVersionSatisfactory is true when version meets minimum', () {
testWithoutContext('version checks pass when version meets minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(13, 0, 0);
xcodeProjectInterpreter.version = Version(13, null, null);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
expect(xcode.isRecommendedVersionSatisfactory, isTrue);
});

testWithoutContext('isRecommendedVersionSatisfactory is true when major version exceeds minimum', () {
testWithoutContext('version checks pass when major version exceeds minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(14, 0, 0);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
expect(xcode.isRecommendedVersionSatisfactory, isTrue);
});

testWithoutContext('isRecommendedVersionSatisfactory is true when minor version exceeds minimum', () {
testWithoutContext('version checks pass when minor version exceeds minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(13, 3, 0);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
expect(xcode.isRecommendedVersionSatisfactory, isTrue);
});

testWithoutContext('isRecommendedVersionSatisfactory is true when patch version exceeds minimum', () {
testWithoutContext('version checks pass when patch version exceeds minimum', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(13, 0, 2);

expect(xcode.isRequiredVersionSatisfactory, isTrue);
expect(xcode.isRecommendedVersionSatisfactory, isTrue);
});

Expand All @@ -232,7 +197,7 @@ void main() {

testWithoutContext('isInstalledAndMeetsVersionCheck is true when macOS and installed and version is satisfied', () {
xcodeProjectInterpreter.isInstalled = true;
xcodeProjectInterpreter.version = Version(12, 3, null);
xcodeProjectInterpreter.version = Version(13, null, null);

expect(xcode.isInstalledAndMeetsVersionCheck, isTrue);
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main() {
final ValidationResult result = await validator.validate();
expect(result.type, ValidationType.partial);
expect(result.messages.last.type, ValidationMessageType.error);
expect(result.messages.last.message, contains('Flutter requires a minimum Xcode version of 12.3'));
expect(result.messages.last.message, contains('Flutter requires Xcode 13 or higher'));
});

testWithoutContext('Emits partial status when Xcode below recommended version', () async {
Expand All @@ -70,7 +70,7 @@ void main() {
expect(result.type, ValidationType.partial);
expect(result.messages.last.type, ValidationMessageType.hint);
expect(result.messages.last.message, contains('Flutter recommends a minimum Xcode version of 13'));
});
}, skip: true); // [intended] Unskip and update when minimum and required check versions diverge.

testWithoutContext('Emits partial status when Xcode EULA not signed', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_tools/test/src/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {
bool get isInstalled => true;

@override
String get versionText => 'Xcode 12.3';
String get versionText => 'Xcode 13';

@override
Version get version => Version(12, 3, null);
Version get version => Version(13, null, null);

@override
Future<Map<String, String>> getBuildSettings(
Expand Down

0 comments on commit 8f360c9

Please sign in to comment.