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

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

Issue 1460123002: Clean-up the registration of plugins (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 library driver; 5 library driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math'; 9 import 'dart:math';
10 10
11 import 'package:analysis_server/plugin/analysis/resolver_provider.dart'; 11 import 'package:analysis_server/plugin/analysis/resolver_provider.dart';
12 import 'package:analysis_server/src/analysis_server.dart'; 12 import 'package:analysis_server/src/analysis_server.dart';
13 import 'package:analysis_server/src/plugin/linter_plugin.dart'; 13 import 'package:analysis_server/src/plugin/linter_plugin.dart';
14 import 'package:analysis_server/src/plugin/server_plugin.dart'; 14 import 'package:analysis_server/src/plugin/server_plugin.dart';
15 import 'package:analysis_server/src/server/http_server.dart'; 15 import 'package:analysis_server/src/server/http_server.dart';
16 import 'package:analysis_server/src/server/stdio_server.dart'; 16 import 'package:analysis_server/src/server/stdio_server.dart';
17 import 'package:analysis_server/src/socket_server.dart'; 17 import 'package:analysis_server/src/socket_server.dart';
18 import 'package:analysis_server/starter.dart'; 18 import 'package:analysis_server/starter.dart';
19 import 'package:analyzer/file_system/physical_file_system.dart'; 19 import 'package:analyzer/file_system/physical_file_system.dart';
20 import 'package:analyzer/instrumentation/file_instrumentation.dart'; 20 import 'package:analyzer/instrumentation/file_instrumentation.dart';
21 import 'package:analyzer/instrumentation/instrumentation.dart'; 21 import 'package:analyzer/instrumentation/instrumentation.dart';
22 import 'package:analyzer/src/generated/engine.dart'; 22 import 'package:analyzer/src/generated/engine.dart';
23 import 'package:analyzer/src/generated/incremental_logger.dart'; 23 import 'package:analyzer/src/generated/incremental_logger.dart';
24 import 'package:analyzer/src/generated/java_io.dart'; 24 import 'package:analyzer/src/generated/java_io.dart';
25 import 'package:analyzer/src/generated/sdk.dart'; 25 import 'package:analyzer/src/generated/sdk.dart';
26 import 'package:analyzer/src/generated/sdk_io.dart'; 26 import 'package:analyzer/src/generated/sdk_io.dart';
27 import 'package:args/args.dart'; 27 import 'package:args/args.dart';
28 import 'package:linter/src/plugin/linter_plugin.dart'; 28 import 'package:linter/src/plugin/linter_plugin.dart';
29 import 'package:plugin/manager.dart';
29 import 'package:plugin/plugin.dart'; 30 import 'package:plugin/plugin.dart';
30 31
31 /** 32 /**
32 * Initializes incremental logger. 33 * Initializes incremental logger.
33 * 34 *
34 * Supports following formats of [spec]: 35 * Supports following formats of [spec]:
35 * 36 *
36 * "console" - log to the console; 37 * "console" - log to the console;
37 * "file:/some/file/name" - log to the file, overwritten on start. 38 * "file:/some/file/name" - log to the file, overwritten on start.
38 */ 39 */
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 AnalysisEngine.instance.instrumentationService = service; 399 AnalysisEngine.instance.instrumentationService = service;
399 // 400 //
400 // Enable the new task model, if appropriate. 401 // Enable the new task model, if appropriate.
401 // 402 //
402 AnalysisEngine.instance.useTaskModel = !results[DISABLE_NEW_TASK_MODEL]; 403 AnalysisEngine.instance.useTaskModel = !results[DISABLE_NEW_TASK_MODEL];
403 // 404 //
404 // Process all of the plugins so that extensions are registered. 405 // Process all of the plugins so that extensions are registered.
405 // 406 //
406 ServerPlugin serverPlugin = new ServerPlugin(); 407 ServerPlugin serverPlugin = new ServerPlugin();
407 List<Plugin> plugins = <Plugin>[]; 408 List<Plugin> plugins = <Plugin>[];
409 plugins.addAll(AnalysisEngine.instance.supportedPlugins);
408 plugins.add(serverPlugin); 410 plugins.add(serverPlugin);
409 plugins.addAll(_userDefinedPlugins);
410 plugins.add(linterPlugin); 411 plugins.add(linterPlugin);
411 plugins.add(linterServerPlugin); 412 plugins.add(linterServerPlugin);
413 plugins.addAll(_userDefinedPlugins);
412 414
413 // Defer to the extension manager in AE for plugin registration. 415 ExtensionManager manager = new ExtensionManager();
414 AnalysisEngine.instance.userDefinedPlugins = plugins; 416 manager.processPlugins(plugins);
415 // Force registration.
416 AnalysisEngine.instance.taskManager;
417
418 // 417 //
419 // Create the sockets and start listening for requests. 418 // Create the sockets and start listening for requests.
420 // 419 //
421 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, 420 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service,
422 serverPlugin, packageResolverProvider); 421 serverPlugin, packageResolverProvider);
423 httpServer = new HttpAnalysisServer(socketServer); 422 httpServer = new HttpAnalysisServer(socketServer);
424 stdioServer = new StdioAnalysisServer(socketServer); 423 stdioServer = new StdioAnalysisServer(socketServer);
425 socketServer.userDefinedPlugins = _userDefinedPlugins; 424 socketServer.userDefinedPlugins = _userDefinedPlugins;
426 425
427 if (serve_http) { 426 if (serve_http) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 */ 588 */
590 static void _rollLogFiles(String path, int numOld) { 589 static void _rollLogFiles(String path, int numOld) {
591 for (int i = numOld - 1; i >= 0; i--) { 590 for (int i = numOld - 1; i >= 0; i--) {
592 try { 591 try {
593 String oldPath = i == 0 ? path : '$path.$i'; 592 String oldPath = i == 0 ? path : '$path.$i';
594 new File(oldPath).renameSync('$path.${i+1}'); 593 new File(oldPath).renameSync('$path.${i+1}');
595 } catch (e) {} 594 } catch (e) {}
596 } 595 }
597 } 596 }
598 } 597 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | pkg/analyzer/lib/src/generated/engine.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698