Commit 02429cef authored by Devon Carew's avatar Devon Carew Committed by GitHub

Fix the doctor check for the flutter intellij plugin (#12389)

* update the intellij doctor check to support the m18 plugin version

* update to support multiple package names
parent c314548f
......@@ -269,9 +269,9 @@ abstract class IntelliJValidator extends DoctorValidator {
Future<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[];
_validatePackage(messages, 'flutter-intellij.jar', 'Flutter',
minVersion: kMinFlutterPluginVersion);
_validatePackage(messages, 'Dart', 'Dart');
_validatePackage(messages, <String>['flutter-intellij', 'flutter-intellij.jar'],
'Flutter', minVersion: kMinFlutterPluginVersion);
_validatePackage(messages, <String>['Dart'], 'Dart');
if (_hasIssues(messages)) {
messages.add(new ValidationMessage(
......@@ -309,26 +309,32 @@ abstract class IntelliJValidator extends DoctorValidator {
}
}
void _validatePackage(List<ValidationMessage> messages, String packageName, String title, {
void _validatePackage(List<ValidationMessage> messages, List<String> packageNames, String title, {
Version minVersion
}) {
if (!hasPackage(packageName)) {
messages.add(new ValidationMessage.error(
'$title plugin not installed; this adds $title specific functionality.'
));
return;
}
final String versionText = _readPackageVersion(packageName);
final Version version = new Version.parse(versionText);
if (version != null && minVersion != null && version < minVersion) {
for (String packageName in packageNames) {
if (!hasPackage(packageName)) {
continue;
}
final String versionText = _readPackageVersion(packageName);
final Version version = new Version.parse(versionText);
if (version != null && minVersion != null && version < minVersion) {
messages.add(new ValidationMessage.error(
'$title plugin version $versionText - the recommended minimum version is $minVersion'
));
} else {
messages.add(new ValidationMessage(
'$title plugin ${version != null ? "version $version" : "installed"}'
));
} else {
messages.add(new ValidationMessage(
'$title plugin ${version != null ? "version $version" : "installed"}'
));
}
return;
}
messages.add(new ValidationMessage.error(
'$title plugin not installed; this adds $title specific functionality.'
));
}
String _readPackageVersion(String packageName) {
......
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