[flutter_tools] Add documentation to "cmdline-tools component is missing" doctor validation error (#83356)

This commit is contained in:
Taha Tesser 2021-05-26 20:59:02 +03:00 committed by GitHub
parent b9377f358c
commit f9cd87e60a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -186,7 +186,7 @@ class AndroidValidator extends DoctorValidator {
return ValidationResult(ValidationType.missing, messages);
}
if (!androidSdk.cmdlineToolsAvailable) {
messages.add(const ValidationMessage.error('cmdline-tools component is missing'));
messages.add(ValidationMessage.error(_userMessages.androidMissingCmdTools));
return ValidationResult(ValidationType.missing, messages);
}

View File

@ -120,6 +120,9 @@ class UserMessages {
String androidSdkBuildToolsOutdated(String managerPath, int sdkMinVersion, String buildToolsMinVersion, Platform platform) =>
'Flutter requires Android SDK $sdkMinVersion and the Android BuildTools $buildToolsMinVersion\n'
'To update the Android SDK visit ${_androidSdkInstallUrl(platform)} for detailed instructions.';
String get androidMissingCmdTools => 'cmdline-tools component is missing\n'
'Run `path/to/sdkmanager --install "cmdline-tools;latest"`\n'
'See https://developer.android.com/studio/command-line for more details.';
// Messages used in AndroidStudioValidator
String androidStudioVersion(String version) => 'version $version';

View File

@ -395,11 +395,13 @@ Review licenses that have not been accepted (y/N)?
userMessages: UserMessages(),
);
final String errorMessage = UserMessages().androidMissingCmdTools;
final ValidationResult validationResult = await androidValidator.validate();
expect(validationResult.type, ValidationType.missing);
expect(
validationResult.messages.last.message,
'cmdline-tools component is missing',
errorMessage,
);
});