| OLD | NEW |
| 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/src/analysis_server.dart'; | 11 import 'package:analysis_server/src/analysis_server.dart'; |
| 12 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 12 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 13 import 'package:analysis_server/src/server/http_server.dart'; | 13 import 'package:analysis_server/src/server/http_server.dart'; |
| 14 import 'package:analysis_server/src/server/stdio_server.dart'; | 14 import 'package:analysis_server/src/server/stdio_server.dart'; |
| 15 import 'package:analysis_server/src/socket_server.dart'; | 15 import 'package:analysis_server/src/socket_server.dart'; |
| 16 import 'package:analysis_server/starter.dart'; | 16 import 'package:analysis_server/starter.dart'; |
| 17 import 'package:analysis_server/uri/resolver_provider.dart'; |
| 17 import 'package:analyzer/file_system/physical_file_system.dart'; | 18 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 18 import 'package:analyzer/instrumentation/file_instrumentation.dart'; | 19 import 'package:analyzer/instrumentation/file_instrumentation.dart'; |
| 19 import 'package:analyzer/instrumentation/instrumentation.dart'; | 20 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 20 import 'package:analyzer/src/generated/engine.dart'; | 21 import 'package:analyzer/src/generated/engine.dart'; |
| 21 import 'package:analyzer/src/generated/incremental_logger.dart'; | 22 import 'package:analyzer/src/generated/incremental_logger.dart'; |
| 22 import 'package:analyzer/src/generated/java_io.dart'; | 23 import 'package:analyzer/src/generated/java_io.dart'; |
| 23 import 'package:analyzer/src/generated/sdk.dart'; | 24 import 'package:analyzer/src/generated/sdk.dart'; |
| 24 import 'package:analyzer/src/generated/sdk_io.dart'; | 25 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 25 import 'package:args/args.dart'; | 26 import 'package:args/args.dart'; |
| 26 import 'package:plugin/manager.dart'; | 27 import 'package:plugin/manager.dart'; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 * operational. | 277 * operational. |
| 277 */ | 278 */ |
| 278 static const String SDK_OPTION = "sdk"; | 279 static const String SDK_OPTION = "sdk"; |
| 279 | 280 |
| 280 /** | 281 /** |
| 281 * The instrumentation server that is to be used by the analysis server. | 282 * The instrumentation server that is to be used by the analysis server. |
| 282 */ | 283 */ |
| 283 InstrumentationServer instrumentationServer; | 284 InstrumentationServer instrumentationServer; |
| 284 | 285 |
| 285 /** | 286 /** |
| 287 * The package resolver provider used to override the way package URI's are |
| 288 * resolved in some contexts. |
| 289 */ |
| 290 ResolverProvider packageResolverProvider; |
| 291 |
| 292 /** |
| 286 * The plugins that are defined outside the analysis_server package. | 293 * The plugins that are defined outside the analysis_server package. |
| 287 */ | 294 */ |
| 288 List<Plugin> _userDefinedPlugins = <Plugin>[]; | 295 List<Plugin> _userDefinedPlugins = <Plugin>[]; |
| 289 | 296 |
| 290 SocketServer socketServer; | 297 SocketServer socketServer; |
| 291 | 298 |
| 292 HttpAnalysisServer httpServer; | 299 HttpAnalysisServer httpServer; |
| 293 | 300 |
| 294 StdioAnalysisServer stdioServer; | 301 StdioAnalysisServer stdioServer; |
| 295 | 302 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 ServerPlugin serverPlugin = new ServerPlugin(); | 388 ServerPlugin serverPlugin = new ServerPlugin(); |
| 382 List<Plugin> plugins = <Plugin>[]; | 389 List<Plugin> plugins = <Plugin>[]; |
| 383 plugins.add(AnalysisEngine.instance.enginePlugin); | 390 plugins.add(AnalysisEngine.instance.enginePlugin); |
| 384 plugins.add(serverPlugin); | 391 plugins.add(serverPlugin); |
| 385 plugins.addAll(_userDefinedPlugins); | 392 plugins.addAll(_userDefinedPlugins); |
| 386 ExtensionManager manager = new ExtensionManager(); | 393 ExtensionManager manager = new ExtensionManager(); |
| 387 manager.processPlugins(plugins); | 394 manager.processPlugins(plugins); |
| 388 // | 395 // |
| 389 // Create the sockets and start listening for requests. | 396 // Create the sockets and start listening for requests. |
| 390 // | 397 // |
| 391 socketServer = new SocketServer( | 398 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, |
| 392 analysisServerOptions, defaultSdk, service, serverPlugin); | 399 serverPlugin, packageResolverProvider); |
| 393 httpServer = new HttpAnalysisServer(socketServer); | 400 httpServer = new HttpAnalysisServer(socketServer); |
| 394 stdioServer = new StdioAnalysisServer(socketServer); | 401 stdioServer = new StdioAnalysisServer(socketServer); |
| 395 socketServer.userDefinedPlugins = _userDefinedPlugins; | 402 socketServer.userDefinedPlugins = _userDefinedPlugins; |
| 396 | 403 |
| 397 if (serve_http) { | 404 if (serve_http) { |
| 398 httpServer.serveHttp(port); | 405 httpServer.serveHttp(port); |
| 399 } | 406 } |
| 400 | 407 |
| 401 _captureExceptions(service, () { | 408 _captureExceptions(service, () { |
| 402 stdioServer.serveStdio().then((_) { | 409 stdioServer.serveStdio().then((_) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 uuidFile.parent.createSync(recursive: true); | 544 uuidFile.parent.createSync(recursive: true); |
| 538 uuidFile.writeAsStringSync(uuid); | 545 uuidFile.writeAsStringSync(uuid); |
| 539 } catch (exception, stackTrace) { | 546 } catch (exception, stackTrace) { |
| 540 service.logPriorityException(exception, stackTrace); | 547 service.logPriorityException(exception, stackTrace); |
| 541 // Slightly alter the uuid to indicate it was not persisted | 548 // Slightly alter the uuid to indicate it was not persisted |
| 542 uuid = 'temp-$uuid'; | 549 uuid = 'temp-$uuid'; |
| 543 } | 550 } |
| 544 return uuid; | 551 return uuid; |
| 545 } | 552 } |
| 546 } | 553 } |
| OLD | NEW |