Unverified Commit 325cfb0f authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Make doctor Xcode version requirement clearer (#88137)

parent 10aad08a
...@@ -145,9 +145,14 @@ class UserMessages { ...@@ -145,9 +145,14 @@ class UserMessages {
// Messages used in XcodeValidator // Messages used in XcodeValidator
String xcodeLocation(String location) => 'Xcode at $location'; String xcodeLocation(String location) => 'Xcode at $location';
String xcodeOutdated(String currentVersion, String recommendedVersion) => String xcodeOutdated(String requiredVersion) =>
'Xcode $currentVersion out of date ($recommendedVersion is recommended).\n' 'Flutter requires a minimum Xcode version of $requiredVersion.\n'
'Download the latest version or update via the Mac App Store.'; 'Download the latest version or update via the Mac App Store.';
String xcodeRecommended(String recommendedVersion) =>
'Flutter recommends a minimum Xcode version of $recommendedVersion.\n'
'Download the latest version or update via the Mac App Store.';
String get xcodeEula => "Xcode end user license agreement not signed; open Xcode or run the command 'sudo xcodebuild -license'."; String get xcodeEula => "Xcode end user license agreement not signed; open Xcode or run the command 'sudo xcodebuild -license'.";
String get xcodeMissingSimct => String get xcodeMissingSimct =>
'Xcode requires additional components to be installed in order to run.\n' 'Xcode requires additional components to be installed in order to run.\n'
......
...@@ -37,16 +37,10 @@ class XcodeValidator extends DoctorValidator { ...@@ -37,16 +37,10 @@ class XcodeValidator extends DoctorValidator {
if (!_xcode.isInstalledAndMeetsVersionCheck) { if (!_xcode.isInstalledAndMeetsVersionCheck) {
xcodeStatus = ValidationType.partial; xcodeStatus = ValidationType.partial;
messages.add(ValidationMessage.error(_userMessages.xcodeOutdated( messages.add(ValidationMessage.error(_userMessages.xcodeOutdated(xcodeRequiredVersion.toString())));
_xcode.currentVersion.toString(),
xcodeRecommendedVersion.toString(),
)));
} else if (!_xcode.isRecommendedVersionSatisfactory) { } else if (!_xcode.isRecommendedVersionSatisfactory) {
xcodeStatus = ValidationType.partial; xcodeStatus = ValidationType.partial;
messages.add(ValidationMessage.hint(_userMessages.xcodeOutdated( messages.add(ValidationMessage.hint(_userMessages.xcodeRecommended(xcodeRecommendedVersion.toString())));
_xcode.currentVersion.toString(),
xcodeRecommendedVersion.toString(),
)));
} }
if (!_xcode.eulaSigned) { if (!_xcode.eulaSigned) {
......
...@@ -55,20 +55,20 @@ void main() { ...@@ -55,20 +55,20 @@ void main() {
final ValidationResult result = await validator.validate(); final ValidationResult result = await validator.validate();
expect(result.type, ValidationType.partial); expect(result.type, ValidationType.partial);
expect(result.messages.last.type, ValidationMessageType.error); expect(result.messages.last.type, ValidationMessageType.error);
expect(result.messages.last.message, contains('Xcode 7.0.1 out of date (12.0.1 is recommended)')); expect(result.messages.last.message, contains('Flutter requires a minimum Xcode version of 12.0.1'));
}); });
testWithoutContext('Emits partial status when Xcode below recommended version', () async { testWithoutContext('Emits partial status when Xcode below recommended version', () async {
final ProcessManager processManager = FakeProcessManager.any(); final ProcessManager processManager = FakeProcessManager.any();
final Xcode xcode = Xcode.test( final Xcode xcode = Xcode.test(
processManager: processManager, processManager: processManager,
xcodeProjectInterpreter: XcodeProjectInterpreter.test(processManager: processManager, version: Version(11, 0, 0)), xcodeProjectInterpreter: XcodeProjectInterpreter.test(processManager: processManager, version: Version(12, 0, 1)),
); );
final XcodeValidator validator = XcodeValidator(xcode: xcode, userMessages: UserMessages()); final XcodeValidator validator = XcodeValidator(xcode: xcode, userMessages: UserMessages());
final ValidationResult result = await validator.validate(); final ValidationResult result = await validator.validate();
expect(result.type, ValidationType.partial); expect(result.type, ValidationType.partial);
expect(result.messages.last.type, ValidationMessageType.hint); expect(result.messages.last.type, ValidationMessageType.hint);
expect(result.messages.last.message, contains('Xcode 11.0.0 out of date (12.0.1 is recommended)')); expect(result.messages.last.message, contains('Flutter recommends a minimum Xcode version of 12.0.2'));
}, skip: true); // [intended] Unskip and update when minimum and required check versions diverge. }, skip: true); // [intended] Unskip and update when minimum and required check versions diverge.
testWithoutContext('Emits partial status when Xcode EULA not signed', () async { testWithoutContext('Emits partial status when Xcode EULA not signed', () async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment