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

Unified Diff: pkg/analysis_server/lib/src/plugin/plugin_manager.dart

Issue 2949893002: Add support for running pub for plugins (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/src/plugin/plugin_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/plugin/plugin_manager.dart
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index d62ede95d07ef46968caeeab77a20cc83e05172c..7435dfde08152b3d903e91c3e005fc8f89a4fbf2 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
@@ -4,7 +4,8 @@
import 'dart:async';
import 'dart:collection';
-import 'dart:io' show Platform;
+import 'dart:convert';
+import 'dart:io' show Platform, Process, ProcessResult;
import 'package:analysis_server/src/plugin/notification_manager.dart';
import 'package:analyzer/context/context_root.dart' as analyzer;
@@ -23,6 +24,7 @@ import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'package:meta/meta.dart';
+import 'package:path/path.dart' as path;
import 'package:watcher/watcher.dart' as watcher;
/**
@@ -333,7 +335,7 @@ class PluginManager {
bool isNew = plugin == null;
if (isNew) {
List<String> pluginPaths = _pathsFor(path);
- if (pluginPaths == null) {
+ if (pluginPaths == null || pluginPaths[1] == null) {
return;
}
plugin = new DiscoveredPluginInfo(path, pluginPaths[0], pluginPaths[1],
@@ -578,7 +580,21 @@ class PluginManager {
File packagesFile = pluginFolder.getChildAssumingFile('.packages');
if (!packagesFile.exists) {
if (runPub) {
- // TODO(brianwilkerson) Run pub in the pluginFolder.
+ String vmPath = Platform.executable;
+ String pubPath = path.join(path.dirname(vmPath), 'pub');
+ ProcessResult result = Process.runSync(pubPath, <String>['get'],
+ stderrEncoding: UTF8,
+ stdoutEncoding: UTF8,
+ workingDirectory: pluginFolder.path);
+ if (result.exitCode != 0) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.writeln('Failed to run pub get');
+ buffer.writeln(' pluginFolder = ${pluginFolder.path}');
+ buffer.writeln(' exitCode = ${result.exitCode}');
+ buffer.writeln(' stdout = ${result.stdout}');
+ buffer.writeln(' stderr = ${result.stderr}');
+ instrumentationService.logError(buffer.toString());
+ }
if (!packagesFile.exists) {
packagesFile = null;
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/src/plugin/plugin_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698