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

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

Issue 3001413002: Remove uses of the old plugin model from the analysis server (Closed)
Patch Set: Created 3 years, 4 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:core'; 7 import 'dart:core';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 import 'dart:math' show max; 9 import 'dart:math' show max;
10 10
11 import 'package:analysis_server/protocol/protocol.dart'; 11 import 'package:analysis_server/protocol/protocol.dart';
12 import 'package:analysis_server/protocol/protocol_generated.dart' 12 import 'package:analysis_server/protocol/protocol_generated.dart'
13 hide AnalysisOptions; 13 hide AnalysisOptions;
14 import 'package:analysis_server/src/analysis_logger.dart'; 14 import 'package:analysis_server/src/analysis_logger.dart';
15 import 'package:analysis_server/src/channel/channel.dart'; 15 import 'package:analysis_server/src/channel/channel.dart';
16 import 'package:analysis_server/src/collections.dart'; 16 import 'package:analysis_server/src/collections.dart';
17 import 'package:analysis_server/src/computer/computer_highlights.dart'; 17 import 'package:analysis_server/src/computer/computer_highlights.dart';
18 import 'package:analysis_server/src/computer/computer_highlights2.dart'; 18 import 'package:analysis_server/src/computer/computer_highlights2.dart';
19 import 'package:analysis_server/src/computer/computer_outline.dart'; 19 import 'package:analysis_server/src/computer/computer_outline.dart';
20 import 'package:analysis_server/src/computer/new_notifications.dart'; 20 import 'package:analysis_server/src/computer/new_notifications.dart';
21 import 'package:analysis_server/src/context_manager.dart'; 21 import 'package:analysis_server/src/context_manager.dart';
22 import 'package:analysis_server/src/domain_analysis.dart';
23 import 'package:analysis_server/src/domain_analytics.dart';
24 import 'package:analysis_server/src/domain_completion.dart';
25 import 'package:analysis_server/src/domain_diagnostic.dart';
26 import 'package:analysis_server/src/domain_execution.dart';
27 import 'package:analysis_server/src/domain_kythe.dart';
28 import 'package:analysis_server/src/domain_server.dart';
22 import 'package:analysis_server/src/domains/analysis/navigation.dart'; 29 import 'package:analysis_server/src/domains/analysis/navigation.dart';
23 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart'; 30 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart';
24 import 'package:analysis_server/src/domains/analysis/occurrences.dart'; 31 import 'package:analysis_server/src/domains/analysis/occurrences.dart';
25 import 'package:analysis_server/src/domains/analysis/occurrences_dart.dart'; 32 import 'package:analysis_server/src/domains/analysis/occurrences_dart.dart';
33 import 'package:analysis_server/src/edit/edit_domain.dart';
26 import 'package:analysis_server/src/operation/operation_analysis.dart'; 34 import 'package:analysis_server/src/operation/operation_analysis.dart';
27 import 'package:analysis_server/src/plugin/notification_manager.dart'; 35 import 'package:analysis_server/src/plugin/notification_manager.dart';
28 import 'package:analysis_server/src/plugin/plugin_manager.dart'; 36 import 'package:analysis_server/src/plugin/plugin_manager.dart';
29 import 'package:analysis_server/src/plugin/plugin_watcher.dart'; 37 import 'package:analysis_server/src/plugin/plugin_watcher.dart';
30 import 'package:analysis_server/src/plugin/server_plugin.dart';
31 import 'package:analysis_server/src/protocol_server.dart' as server; 38 import 'package:analysis_server/src/protocol_server.dart' as server;
39 import 'package:analysis_server/src/search/search_domain.dart';
32 import 'package:analysis_server/src/server/diagnostic_server.dart'; 40 import 'package:analysis_server/src/server/diagnostic_server.dart';
33 import 'package:analysis_server/src/services/correction/namespace.dart'; 41 import 'package:analysis_server/src/services/correction/namespace.dart';
34 import 'package:analysis_server/src/services/search/search_engine.dart'; 42 import 'package:analysis_server/src/services/search/search_engine.dart';
35 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 43 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
36 import 'package:analysis_server/src/utilities/null_string_sink.dart'; 44 import 'package:analysis_server/src/utilities/null_string_sink.dart';
37 import 'package:analyzer/context/context_root.dart'; 45 import 'package:analyzer/context/context_root.dart';
38 import 'package:analyzer/dart/ast/ast.dart'; 46 import 'package:analyzer/dart/ast/ast.dart';
39 import 'package:analyzer/dart/element/element.dart'; 47 import 'package:analyzer/dart/element/element.dart';
40 import 'package:analyzer/exception/exception.dart'; 48 import 'package:analyzer/exception/exception.dart';
41 import 'package:analyzer/file_system/file_system.dart'; 49 import 'package:analyzer/file_system/file_system.dart';
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 * The [ResourceProvider] using which paths are converted into [Resource]s. 137 * The [ResourceProvider] using which paths are converted into [Resource]s.
130 */ 138 */
131 final ResourceProvider resourceProvider; 139 final ResourceProvider resourceProvider;
132 140
133 /** 141 /**
134 * The [SearchEngine] for this server, may be `null` if indexing is disabled. 142 * The [SearchEngine] for this server, may be `null` if indexing is disabled.
135 */ 143 */
136 SearchEngine searchEngine; 144 SearchEngine searchEngine;
137 145
138 /** 146 /**
139 * The plugin associated with this analysis server.
140 */
141 final ServerPlugin serverPlugin;
142
143 /**
144 * A list of the globs used to determine which files should be analyzed. The 147 * A list of the globs used to determine which files should be analyzed. The
145 * list is lazily created and should be accessed using [analyzedFilesGlobs]. 148 * list is lazily created and should be accessed using [analyzedFilesGlobs].
146 */ 149 */
147 List<Glob> _analyzedFilesGlobs = null; 150 List<Glob> _analyzedFilesGlobs = null;
148 151
149 /** 152 /**
150 * The [ContextManager] that handles the mapping from analysis roots to 153 * The [ContextManager] that handles the mapping from analysis roots to
151 * context directories. 154 * context directories.
152 */ 155 */
153 ContextManager contextManager; 156 ContextManager contextManager;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 * 336 *
334 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are 337 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are
335 * propagated up the call stack. The default is true to allow analysis 338 * propagated up the call stack. The default is true to allow analysis
336 * exceptions to show up in unit tests, but it should be set to false when 339 * exceptions to show up in unit tests, but it should be set to false when
337 * running a full analysis server. 340 * running a full analysis server.
338 */ 341 */
339 AnalysisServer( 342 AnalysisServer(
340 this.channel, 343 this.channel,
341 this.resourceProvider, 344 this.resourceProvider,
342 PubPackageMapProvider packageMapProvider, 345 PubPackageMapProvider packageMapProvider,
343 this.serverPlugin,
344 this.options, 346 this.options,
345 this.sdkManager, 347 this.sdkManager,
346 this.instrumentationService, 348 this.instrumentationService,
347 {this.diagnosticServer, 349 {this.diagnosticServer,
348 ResolverProvider fileResolverProvider: null, 350 ResolverProvider fileResolverProvider: null,
349 ResolverProvider packageResolverProvider: null}) 351 ResolverProvider packageResolverProvider: null})
350 : notificationManager = 352 : notificationManager =
351 new NotificationManager(channel, resourceProvider) { 353 new NotificationManager(channel, resourceProvider) {
352 _performance = performanceDuringStartup; 354 _performance = performanceDuringStartup;
353 355
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 performanceAfterStartup = new ServerPerformance(); 410 performanceAfterStartup = new ServerPerformance();
409 _performance = performanceAfterStartup; 411 _performance = performanceAfterStartup;
410 }); 412 });
411 }); 413 });
412 searchEngine = new SearchEngineImpl(driverMap.values); 414 searchEngine = new SearchEngineImpl(driverMap.values);
413 Notification notification = new ServerConnectedParams(VERSION, io.pid, 415 Notification notification = new ServerConnectedParams(VERSION, io.pid,
414 sessionId: instrumentationService.sessionId) 416 sessionId: instrumentationService.sessionId)
415 .toNotification(); 417 .toNotification();
416 channel.sendNotification(notification); 418 channel.sendNotification(notification);
417 channel.listen(handleRequest, onDone: done, onError: error); 419 channel.listen(handleRequest, onDone: done, onError: error);
418 handlers = serverPlugin.createDomains(this); 420 handlers = <server.RequestHandler>[
421 new ServerDomainHandler(this),
422 new AnalysisDomainHandler(this),
423 new EditDomainHandler(this),
424 new SearchDomainHandler(this),
425 new CompletionDomainHandler(this),
426 new ExecutionDomainHandler(this),
427 new DiagnosticDomainHandler(this),
428 new AnalyticsDomainHandler(this),
429 new KytheDomainHandler(this)
430 ];
419 } 431 }
420 432
421 /** 433 /**
422 * Return a list of the globs used to determine which files should be analyzed . 434 * Return a list of the globs used to determine which files should be analyzed .
423 */ 435 */
424 List<Glob> get analyzedFilesGlobs { 436 List<Glob> get analyzedFilesGlobs {
425 if (_analyzedFilesGlobs == null) { 437 if (_analyzedFilesGlobs == null) {
426 _analyzedFilesGlobs = <Glob>[]; 438 _analyzedFilesGlobs = <Glob>[];
427 List<String> patterns = serverPlugin.analyzedFilePatterns; 439 List<String> patterns = <String>[
440 '**/*.${AnalysisEngine.SUFFIX_DART}',
441 '**/*.${AnalysisEngine.SUFFIX_HTML}',
442 '**/*.${AnalysisEngine.SUFFIX_HTM}',
443 '**/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}',
444 '**/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}'
445 ];
428 for (String pattern in patterns) { 446 for (String pattern in patterns) {
429 try { 447 try {
430 _analyzedFilesGlobs 448 _analyzedFilesGlobs
431 .add(new Glob(resourceProvider.pathContext.separator, pattern)); 449 .add(new Glob(resourceProvider.pathContext.separator, pattern));
432 } catch (exception, stackTrace) { 450 } catch (exception, stackTrace) {
433 AnalysisEngine.instance.logger.logError( 451 AnalysisEngine.instance.logger.logError(
434 'Invalid glob pattern: "$pattern"', 452 'Invalid glob pattern: "$pattern"',
435 new CaughtException(exception, stackTrace)); 453 new CaughtException(exception, stackTrace));
436 } 454 }
437 } 455 }
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 /** 1522 /**
1505 * The [PerformanceTag] for time spent in server request handlers. 1523 * The [PerformanceTag] for time spent in server request handlers.
1506 */ 1524 */
1507 static PerformanceTag serverRequests = server.createChild('requests'); 1525 static PerformanceTag serverRequests = server.createChild('requests');
1508 1526
1509 /** 1527 /**
1510 * The [PerformanceTag] for time spent in split store microtasks. 1528 * The [PerformanceTag] for time spent in split store microtasks.
1511 */ 1529 */
1512 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1530 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1513 } 1531 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/plugin/edit/fix/fix.dart ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698