Rename the plugin location key and directory name

R=mfairhurst@google.com

Review-Url: https://codereview.chromium.org/2952583003 .
This commit is contained in:
Brian Wilkerson 2017-06-20 11:06:38 -07:00
parent d0f8a47f33
commit 5582824e3c
3 changed files with 7 additions and 6 deletions

View file

@ -13,13 +13,13 @@ class PluginLocator {
* The key used in the `pubspec.yaml` file to specify the location of the
* analysis plugin.
*/
static const String analysisPluginKey = 'analysis_plugin';
static const String analyzerPluginKey = 'analyzer_plugin';
/**
* The name of the default plugin directory, located within the `tools`
* directory.
*/
static const String defaultPluginFolderName = 'analysis_plugin';
static const String defaultPluginFolderName = 'analyzer_plugin';
/**
* The name of the `pubspec.yaml` file.
@ -79,7 +79,7 @@ class PluginLocator {
sourceUrl: pubspecFile.toUri());
YamlNode contents = document.contents;
if (contents is YamlMap) {
String pluginPath = contents[analysisPluginKey];
String pluginPath = contents[analyzerPluginKey];
if (pluginPath != null) {
Folder pluginFolder =
packageFolder.getChildAssumingFolder(pluginPath);

View file

@ -76,7 +76,7 @@ class PluginLocatorTest {
resourceProvider.pathContext.join(packageRoot, 'pluginDir');
_createPubspec('''
name: test_project
${PluginLocator.analysisPluginKey}: $nonDefaultPath
${PluginLocator.analyzerPluginKey}: $nonDefaultPath
''');
resourceProvider.newFolder(nonDefaultPath);
return nonDefaultPath;

View file

@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:analysis_server/src/plugin/plugin_locator.dart';
import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/plugin/plugin_watcher.dart';
import 'package:analyzer/context/context_root.dart';
@ -63,8 +64,8 @@ class PluginWatcherTest {
resourceProvider.newFile(
resourceProvider.convertPath('/pkg2/pubspec.yaml'), 'name: pkg2');
resourceProvider.newFile(
resourceProvider
.convertPath('/pkg2/tools/analysis_plugin/bin/plugin.dart'),
resourceProvider.convertPath(
'/pkg2/${PluginLocator.toolsFolderName}/${PluginLocator.defaultPluginFolderName}/bin/plugin.dart'),
'');
await driver.computeResult('package:pkg2/pk2.dart');
//