Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: pkg/analysis_server/lib/src/plugin/plugin_locator.dart

Issue 2836953002: Minor clean-up and bug fix (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/plugin/plugin_manager.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/file_system/file_system.dart'; 5 import 'package:analyzer/file_system/file_system.dart';
6 import 'package:yaml/yaml.dart'; 6 import 'package:yaml/yaml.dart';
7 7
8 /** 8 /**
9 * An object used to locate a plugin within a package. 9 * An object used to locate a plugin within a package.
10 */ 10 */
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 * [resourceProvider] to access the file system. 44 * [resourceProvider] to access the file system.
45 */ 45 */
46 PluginLocator(this.resourceProvider); 46 PluginLocator(this.resourceProvider);
47 47
48 /** 48 /**
49 * Given the root directory of a package (the [packageRoot]), return the path 49 * Given the root directory of a package (the [packageRoot]), return the path
50 * to the plugin associated with the package, or `null` if there is no plugin 50 * to the plugin associated with the package, or `null` if there is no plugin
51 * associated with the package. 51 * associated with the package.
52 * 52 *
53 * This will look first in the `pubspec.yaml` file in the package root for a 53 * This will look first in the `pubspec.yaml` file in the package root for a
54 * key indicating where the plugin is located. If such a key is not defined, 54 * top-level key (`analysis_plugin`) indicating where the plugin is located.
55 * then it will fall back to a well known location within the package. 55 * The value associated with the key is expected to be the path of the plugin
56 * relative to the package root. If the directory exists, the it is returned.
57 *
58 * If the key is not defined in the `pubspec.yaml` file, or if the directory
59 * given does not exist, then this method will look for the directory
60 * `tools/analysis_plugin` relative to the package root. If the directory
61 * exists, the it is returned.
scheglov 2017/04/24 15:33:55 /the/then/s
Brian Wilkerson 2017/04/24 15:48:51 Done
56 * 62 *
57 * This method does not validate the content of the plugin directory before 63 * This method does not validate the content of the plugin directory before
58 * returning it. 64 * returning it.
59 */ 65 */
60 String findPlugin(String packageRoot) { 66 String findPlugin(String packageRoot) {
61 return pluginMap.putIfAbsent(packageRoot, () => _findPlugin(packageRoot)); 67 return pluginMap.putIfAbsent(packageRoot, () => _findPlugin(packageRoot));
62 } 68 }
63 69
64 /** 70 /**
65 * The implementation of [findPlugin]. 71 * The implementation of [findPlugin].
(...skipping 22 matching lines...) Expand all
88 } 94 }
89 Folder pluginFolder = packageFolder 95 Folder pluginFolder = packageFolder
90 .getChildAssumingFolder(toolsFolderName) 96 .getChildAssumingFolder(toolsFolderName)
91 .getChildAssumingFolder(defaultPluginFolderName); 97 .getChildAssumingFolder(defaultPluginFolderName);
92 if (pluginFolder.exists) { 98 if (pluginFolder.exists) {
93 return pluginFolder.path; 99 return pluginFolder.path;
94 } 100 }
95 return null; 101 return null;
96 } 102 }
97 } 103 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/plugin/plugin_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698