| 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/context_manager.dart'; | |
| 13 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 12 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 14 import 'package:analysis_server/src/server/http_server.dart'; | 13 import 'package:analysis_server/src/server/http_server.dart'; |
| 15 import 'package:analysis_server/src/server/stdio_server.dart'; | 14 import 'package:analysis_server/src/server/stdio_server.dart'; |
| 16 import 'package:analysis_server/src/socket_server.dart'; | 15 import 'package:analysis_server/src/socket_server.dart'; |
| 17 import 'package:analysis_server/starter.dart'; | 16 import 'package:analysis_server/starter.dart'; |
| 18 import 'package:analysis_server/uri/resolver_provider.dart'; | 17 import 'package:analysis_server/uri/resolver_provider.dart'; |
| 19 import 'package:analyzer/file_system/physical_file_system.dart'; | 18 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 20 import 'package:analyzer/instrumentation/file_instrumentation.dart'; | 19 import 'package:analyzer/instrumentation/file_instrumentation.dart'; |
| 21 import 'package:analyzer/instrumentation/instrumentation.dart'; | 20 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 22 import 'package:analyzer/src/generated/engine.dart'; | 21 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 * operational. | 291 * operational. |
| 293 */ | 292 */ |
| 294 static const String SDK_OPTION = "sdk"; | 293 static const String SDK_OPTION = "sdk"; |
| 295 | 294 |
| 296 /** | 295 /** |
| 297 * The instrumentation server that is to be used by the analysis server. | 296 * The instrumentation server that is to be used by the analysis server. |
| 298 */ | 297 */ |
| 299 InstrumentationServer instrumentationServer; | 298 InstrumentationServer instrumentationServer; |
| 300 | 299 |
| 301 /** | 300 /** |
| 302 * The context manager used to create analysis contexts within each of the | |
| 303 * analysis roots. | |
| 304 */ | |
| 305 ContextManager contextManager; | |
| 306 | |
| 307 /** | |
| 308 * The package resolver provider used to override the way package URI's are | 301 * The package resolver provider used to override the way package URI's are |
| 309 * resolved in some contexts. | 302 * resolved in some contexts. |
| 310 */ | 303 */ |
| 311 @deprecated | |
| 312 ResolverProvider packageResolverProvider; | 304 ResolverProvider packageResolverProvider; |
| 313 | 305 |
| 314 /** | 306 /** |
| 315 * The plugins that are defined outside the analysis_server package. | 307 * The plugins that are defined outside the analysis_server package. |
| 316 */ | 308 */ |
| 317 List<Plugin> _userDefinedPlugins = <Plugin>[]; | 309 List<Plugin> _userDefinedPlugins = <Plugin>[]; |
| 318 | 310 |
| 319 SocketServer socketServer; | 311 SocketServer socketServer; |
| 320 | 312 |
| 321 HttpAnalysisServer httpServer; | 313 HttpAnalysisServer httpServer; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 List<Plugin> plugins = <Plugin>[]; | 405 List<Plugin> plugins = <Plugin>[]; |
| 414 plugins.add(AnalysisEngine.instance.enginePlugin); | 406 plugins.add(AnalysisEngine.instance.enginePlugin); |
| 415 plugins.add(serverPlugin); | 407 plugins.add(serverPlugin); |
| 416 plugins.addAll(_userDefinedPlugins); | 408 plugins.addAll(_userDefinedPlugins); |
| 417 ExtensionManager manager = new ExtensionManager(); | 409 ExtensionManager manager = new ExtensionManager(); |
| 418 manager.processPlugins(plugins); | 410 manager.processPlugins(plugins); |
| 419 // | 411 // |
| 420 // Create the sockets and start listening for requests. | 412 // Create the sockets and start listening for requests. |
| 421 // | 413 // |
| 422 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, | 414 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, |
| 423 serverPlugin, contextManager, packageResolverProvider); | 415 serverPlugin, packageResolverProvider); |
| 424 httpServer = new HttpAnalysisServer(socketServer); | 416 httpServer = new HttpAnalysisServer(socketServer); |
| 425 stdioServer = new StdioAnalysisServer(socketServer); | 417 stdioServer = new StdioAnalysisServer(socketServer); |
| 426 socketServer.userDefinedPlugins = _userDefinedPlugins; | 418 socketServer.userDefinedPlugins = _userDefinedPlugins; |
| 427 | 419 |
| 428 if (serve_http) { | 420 if (serve_http) { |
| 429 httpServer.serveHttp(port); | 421 httpServer.serveHttp(port); |
| 430 } | 422 } |
| 431 | 423 |
| 432 _captureExceptions(service, () { | 424 _captureExceptions(service, () { |
| 433 stdioServer.serveStdio().then((_) { | 425 stdioServer.serveStdio().then((_) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 uuidFile.parent.createSync(recursive: true); | 565 uuidFile.parent.createSync(recursive: true); |
| 574 uuidFile.writeAsStringSync(uuid); | 566 uuidFile.writeAsStringSync(uuid); |
| 575 } catch (exception, stackTrace) { | 567 } catch (exception, stackTrace) { |
| 576 service.logPriorityException(exception, stackTrace); | 568 service.logPriorityException(exception, stackTrace); |
| 577 // Slightly alter the uuid to indicate it was not persisted | 569 // Slightly alter the uuid to indicate it was not persisted |
| 578 uuid = 'temp-$uuid'; | 570 uuid = 'temp-$uuid'; |
| 579 } | 571 } |
| 580 return uuid; | 572 return uuid; |
| 581 } | 573 } |
| 582 } | 574 } |
| OLD | NEW |