Index: pkg/analysis_server/lib/src/plugin/plugin_locator.dart |
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_locator.dart b/pkg/analysis_server/lib/src/plugin/plugin_locator.dart |
index 968ee5384011d96ed66c33dae242ae9a7b6f4b88..85e3527fe83177a580d7e6240fbc1e41d6108ed0 100644 |
--- a/pkg/analysis_server/lib/src/plugin/plugin_locator.dart |
+++ b/pkg/analysis_server/lib/src/plugin/plugin_locator.dart |
@@ -37,6 +37,8 @@ class PluginLocator { |
*/ |
final ResourceProvider resourceProvider; |
+ final Map<String, String> pluginMap = <String, String>{}; |
+ |
/** |
* Initialize a newly created plugin locator to use the given |
* [resourceProvider] to access the file system. |
@@ -56,6 +58,13 @@ class PluginLocator { |
* returning it. |
*/ |
String findPlugin(String packageRoot) { |
+ return pluginMap.putIfAbsent(packageRoot, () => _findPlugin(packageRoot)); |
+ } |
+ |
+ /** |
+ * The implementation of [findPlugin]. |
+ */ |
+ String _findPlugin(String packageRoot) { |
Folder packageFolder = resourceProvider.getFolder(packageRoot); |
File pubspecFile = packageFolder.getChildAssumingFile(pubspecFileName); |
if (pubspecFile.exists) { |