Unverified Commit 42a6b791 authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

[tools] Add Xcode version to non-verbose Flutter doctor (#87022)

parent a1ae4fea
...@@ -58,6 +58,7 @@ class XcodeProjectInterpreter { ...@@ -58,6 +58,7 @@ class XcodeProjectInterpreter {
processManager: processManager, processManager: processManager,
), ),
_version = version, _version = version,
_versionText = version?.toString(),
_usage = usage; _usage = usage;
/// Create an [XcodeProjectInterpreter] for testing. /// Create an [XcodeProjectInterpreter] for testing.
......
...@@ -32,9 +32,11 @@ class XcodeValidator extends DoctorValidator { ...@@ -32,9 +32,11 @@ class XcodeValidator extends DoctorValidator {
} }
final String? versionText = _xcode.versionText; final String? versionText = _xcode.versionText;
if (versionText != null) { if (versionText != null) {
messages.add(ValidationMessage(versionText)); xcodeVersionInfo = versionText;
if (xcodeVersionInfo.contains(',')) {
xcodeVersionInfo = xcodeVersionInfo.substring(0, xcodeVersionInfo.indexOf(','));
}
} }
if (!_xcode.isInstalledAndMeetsVersionCheck) { if (!_xcode.isInstalledAndMeetsVersionCheck) {
xcodeStatus = ValidationType.partial; xcodeStatus = ValidationType.partial;
messages.add(ValidationMessage.error(_userMessages.xcodeOutdated(xcodeRequiredVersion.toString()))); messages.add(ValidationMessage.error(_userMessages.xcodeOutdated(xcodeRequiredVersion.toString())));
......
...@@ -23,6 +23,7 @@ void main() { ...@@ -23,6 +23,7 @@ void main() {
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.missing); expect(result.type, ValidationType.missing);
expect(result.statusInfo, isNull);
expect(result.messages.last.type, ValidationMessageType.error); expect(result.messages.last.type, ValidationMessageType.error);
expect(result.messages.last.message, contains('Xcode not installed')); expect(result.messages.last.message, contains('Xcode not installed'));
}); });
...@@ -182,6 +183,11 @@ void main() { ...@@ -182,6 +183,11 @@ void main() {
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.installed); expect(result.type, ValidationType.installed);
expect(result.messages.length, 1);
final ValidationMessage firstMessage = result.messages.first;
expect(firstMessage.type, ValidationMessageType.information);
expect(firstMessage.message, 'Xcode at /Library/Developer/CommandLineTools');
expect(result.statusInfo, '1000.0.0');
}); });
}); });
} }
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