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