Unverified Commit 2f916790 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Show Android SDK path in doctor on partial installation (#87232)

parent 246f313c
...@@ -183,6 +183,9 @@ class AndroidValidator extends DoctorValidator { ...@@ -183,6 +183,9 @@ class AndroidValidator extends DoctorValidator {
} }
return ValidationResult(ValidationType.missing, messages); return ValidationResult(ValidationType.missing, messages);
} }
messages.add(ValidationMessage(_userMessages.androidSdkLocation(androidSdk.directory.path)));
if (!androidSdk.cmdlineToolsAvailable) { if (!androidSdk.cmdlineToolsAvailable) {
messages.add(ValidationMessage.error(_userMessages.androidMissingCmdTools)); messages.add(ValidationMessage.error(_userMessages.androidMissingCmdTools));
return ValidationResult(ValidationType.missing, messages); return ValidationResult(ValidationType.missing, messages);
...@@ -193,8 +196,6 @@ class AndroidValidator extends DoctorValidator { ...@@ -193,8 +196,6 @@ class AndroidValidator extends DoctorValidator {
return ValidationResult(ValidationType.partial, messages); return ValidationResult(ValidationType.partial, messages);
} }
messages.add(ValidationMessage(_userMessages.androidSdkLocation(androidSdk.directory.path)));
String? sdkVersionText; String? sdkVersionText;
final AndroidSdkVersion? androidSdkLatestVersion = androidSdk.latestVersion; final AndroidSdkVersion? androidSdkLatestVersion = androidSdk.latestVersion;
if (androidSdkLatestVersion != null) { if (androidSdkLatestVersion != null) {
......
...@@ -342,7 +342,8 @@ Review licenses that have not been accepted (y/N)? ...@@ -342,7 +342,8 @@ Review licenses that have not been accepted (y/N)?
sdk sdk
..licensesAvailable = true ..licensesAvailable = true
..platformToolsAvailable = false ..platformToolsAvailable = false
..cmdlineToolsAvailable = true; ..cmdlineToolsAvailable = true
..directory = fileSystem.directory('/foo/bar');
final ValidationResult validationResult = await AndroidValidator( final ValidationResult validationResult = await AndroidValidator(
androidStudio: null, androidStudio: null,
androidSdk: sdk, androidSdk: sdk,
...@@ -354,10 +355,14 @@ Review licenses that have not been accepted (y/N)? ...@@ -354,10 +355,14 @@ Review licenses that have not been accepted (y/N)?
).validate(); ).validate();
expect(validationResult.type, ValidationType.partial); expect(validationResult.type, ValidationType.partial);
expect(
validationResult.messages.map((ValidationMessage message) => message.message), final ValidationMessage sdkMessage = validationResult.messages.first;
contains(contains(UserMessages().androidSdkLicenseOnly(kAndroidHome))), expect(sdkMessage.type, ValidationMessageType.information);
); expect(sdkMessage.message, 'Android SDK at /foo/bar');
final ValidationMessage licenseMessage = validationResult.messages.last;
expect(licenseMessage.type, ValidationMessageType.hint);
expect(licenseMessage.message, UserMessages().androidSdkLicenseOnly(kAndroidHome));
}); });
testWithoutContext('detects minimum required SDK and buildtools', () async { testWithoutContext('detects minimum required SDK and buildtools', () async {
...@@ -432,7 +437,8 @@ Review licenses that have not been accepted (y/N)? ...@@ -432,7 +437,8 @@ Review licenses that have not been accepted (y/N)?
sdk sdk
..licensesAvailable = true ..licensesAvailable = true
..platformToolsAvailable = true ..platformToolsAvailable = true
..cmdlineToolsAvailable = false; ..cmdlineToolsAvailable = false
..directory = fileSystem.directory('/foo/bar');
final AndroidValidator androidValidator = AndroidValidator( final AndroidValidator androidValidator = AndroidValidator(
androidStudio: null, androidStudio: null,
...@@ -448,10 +454,14 @@ Review licenses that have not been accepted (y/N)? ...@@ -448,10 +454,14 @@ Review licenses that have not been accepted (y/N)?
final ValidationResult validationResult = await androidValidator.validate(); final ValidationResult validationResult = await androidValidator.validate();
expect(validationResult.type, ValidationType.missing); expect(validationResult.type, ValidationType.missing);
expect(
validationResult.messages.last.message, final ValidationMessage sdkMessage = validationResult.messages.first;
errorMessage, expect(sdkMessage.type, ValidationMessageType.information);
); expect(sdkMessage.message, 'Android SDK at /foo/bar');
final ValidationMessage cmdlineMessage = validationResult.messages.last;
expect(cmdlineMessage.type, ValidationMessageType.error);
expect(cmdlineMessage.message, errorMessage);
}); });
testWithoutContext('detects minimum required java version', () async { testWithoutContext('detects minimum required java version', () 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