fix(doctor): add an alternative path for the Dart plugin (#163215)

It seems like with some recent plugin/IDE version, the path for the Dart
plugin has changed from `<base path>/Dart` to `<base path>/dart`,
causing `flutter doctor` to incorrectly assume that the plugin is not
installed.

Add `dart` as an alternative to the existing `Dart` package name.

Fixes #163214.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
Kamil Szczęk
2025-03-18 10:35:34 +01:00
committed by GitHub
parent 92b391d97b
commit 4c35308ccf
3 changed files with 33 additions and 6 deletions

View File

@@ -76,7 +76,7 @@ class AndroidStudioValidator extends DoctorValidator {
);
plugins.validatePackage(
messages,
<String>['Dart'],
<String>['Dart', 'dart'],
'Dart',
IntelliJPlugins.kIntellijDartPluginUrl,
);

View File

@@ -109,7 +109,7 @@ abstract class IntelliJValidator extends DoctorValidator {
);
plugins.validatePackage(
messages,
<String>['Dart'],
<String>['Dart', 'dart'],
'Dart',
IntelliJPlugins.kIntellijDartPluginUrl,
);

View File

@@ -52,7 +52,7 @@ void main() {
);
final List<ValidationMessage> messages = <ValidationMessage>[];
plugins.validatePackage(messages, <String>['Dart'], 'Dart', 'download-Dart');
plugins.validatePackage(messages, <String>['Dart', 'dart'], 'Dart', 'download-Dart');
plugins.validatePackage(
messages,
<String>['flutter-intellij', 'flutter-intellij.jar'],
@@ -156,7 +156,7 @@ Manifest-Version: 1.0
final IntelliJPlugins plugins = IntelliJPlugins(_kPluginsPath, fileSystem: fileSystem);
final List<ValidationMessage> messages = <ValidationMessage>[];
plugins.validatePackage(messages, <String>['Dart'], 'Dart', 'download-Dart');
plugins.validatePackage(messages, <String>['Dart', 'dart'], 'Dart', 'download-Dart');
plugins.validatePackage(
messages,
<String>['flutter-intellij', 'flutter-intellij.jar'],
@@ -188,11 +188,38 @@ Manifest-Version: 1.0
);
expect(
() =>
plugins.validatePackage(<ValidationMessage>[], <String>['Dart'], 'Dart', 'download-Dart'),
() => plugins.validatePackage(
<ValidationMessage>[],
<String>['Dart', 'dart'],
'Dart',
'download-Dart',
),
returnsNormally,
);
});
// Regression test for https://github.com/flutter/flutter/issues/163214
testWithoutContext(
'IntelliJPlugins can find the Dart plugin with a lowercase package name',
() async {
final IntelliJPlugins plugins = IntelliJPlugins(_kPluginsPath, fileSystem: fileSystem);
final Archive dartJarArchive = buildSingleFileArchive('META-INF/plugin.xml', r'''
<idea-plugin>
<name>Dart</name>
<version>242.24931</version>
</idea-plugin>''');
writeFileCreatingDirectories(
fileSystem.path.join(_kPluginsPath, 'dart', 'lib', 'dart.jar'),
ZipEncoder().encode(dartJarArchive)!,
);
final List<ValidationMessage> messages = <ValidationMessage>[];
plugins.validatePackage(messages, <String>['Dart', 'dart'], 'Dart', 'download-Dart');
expect(messages.length, equals(1));
expect(messages.single.message, equals('Dart plugin version 242.24931'));
},
);
}
const String _kPluginsPath = '/data/intellij/plugins';