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

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

Issue 2795743002: Add context information to driver and add hooks for plugin management (Closed)
Patch Set: Created 3 years, 9 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/lib/src/context_manager.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 64164b21c9bd9b3f41a2513d8c71615ce1fb4b40..78b8bcb87fe14141916e191d9a0a411ce36badd7 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -28,6 +28,8 @@ import 'package:analysis_server/src/operation/operation.dart';
import 'package:analysis_server/src/operation/operation_analysis.dart';
import 'package:analysis_server/src/operation/operation_queue.dart';
import 'package:analysis_server/src/plugin/notification_manager.dart';
+import 'package:analysis_server/src/plugin/plugin_manager.dart';
+import 'package:analysis_server/src/plugin/plugin_watcher.dart';
import 'package:analysis_server/src/plugin/server_plugin.dart';
import 'package:analysis_server/src/protocol_server.dart' as server;
import 'package:analysis_server/src/server/diagnostic_server.dart';
@@ -38,6 +40,7 @@ import 'package:analysis_server/src/services/search/search_engine_internal.dart'
import 'package:analysis_server/src/services/search/search_engine_internal2.dart';
import 'package:analysis_server/src/single_context_manager.dart';
import 'package:analysis_server/src/utilities/null_string_sink.dart';
+import 'package:analyzer/context/context_root.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -135,6 +138,11 @@ class AnalysisServer {
final NotificationManager notificationManager;
/**
+ * The object used to manage the execution of plugins.
+ */
+ PluginManager pluginManager;
+
+ /**
* The [ResourceProvider] using which paths are converted into [Resource]s.
*/
final ResourceProvider resourceProvider;
@@ -391,6 +399,12 @@ class AnalysisServer {
: notificationManager =
new NotificationManager(channel, resourceProvider) {
_performance = performanceDuringStartup;
+
+ pluginManager = new PluginManager(resourceProvider, _getByteStorePath(),
+ notificationManager, instrumentationService);
+ PluginWatcher pluginWatcher =
+ new PluginWatcher(resourceProvider, pluginManager);
+
defaultContextOptions.incremental = true;
defaultContextOptions.incrementalApi =
options.enableIncrementalResolutionApi;
@@ -415,8 +429,9 @@ class AnalysisServer {
_analysisPerformanceLogger = new nd.PerformanceLog(sink);
}
byteStore = _createByteStore();
- analysisDriverScheduler =
- new nd.AnalysisDriverScheduler(_analysisPerformanceLogger);
+ analysisDriverScheduler = new nd.AnalysisDriverScheduler(
+ _analysisPerformanceLogger,
+ driverWatcher: pluginWatcher);
analysisDriverScheduler.status.listen(sendStatusNotificationNew);
analysisDriverScheduler.start();
@@ -1734,6 +1749,21 @@ class AnalysisServer {
}
/**
+ * Return the path to the location of the byte store on disk, or `null` if
+ * there is no on-disk byte store.
+ */
+ String _getByteStorePath() {
+ if (resourceProvider is PhysicalResourceProvider) {
+ Folder stateLocation =
+ resourceProvider.getStateLocation('.analysis-driver');
+ if (stateLocation != null) {
+ return stateLocation.path;
+ }
+ }
+ return null;
+ }
+
+ /**
* Return a set of all contexts whose associated folder is contained within,
* or equal to, one of the resources in the given list of [resources].
*/
@@ -1902,9 +1932,10 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider);
@override
- nd.AnalysisDriver addAnalysisDriver(Folder folder, AnalysisOptions options) {
+ nd.AnalysisDriver addAnalysisDriver(
+ Folder folder, ContextRoot contextRoot, AnalysisOptions options) {
ContextBuilder builder = createContextBuilder(folder, options);
- nd.AnalysisDriver analysisDriver = builder.buildDriver(folder.path);
+ nd.AnalysisDriver analysisDriver = builder.buildDriver(contextRoot);
analysisDriver.results.listen((result) {
NotificationManager notificationManager =
analysisServer.notificationManager;
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698