| 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'; |
| 12 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 13 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 13 import 'package:analysis_server/src/server/http_server.dart'; | 14 import 'package:analysis_server/src/server/http_server.dart'; |
| 14 import 'package:analysis_server/src/server/stdio_server.dart'; | 15 import 'package:analysis_server/src/server/stdio_server.dart'; |
| 15 import 'package:analysis_server/src/socket_server.dart'; | 16 import 'package:analysis_server/src/socket_server.dart'; |
| 16 import 'package:analysis_server/starter.dart'; | 17 import 'package:analysis_server/starter.dart'; |
| 17 import 'package:analysis_server/uri/resolver_provider.dart'; | 18 import 'package:analysis_server/uri/resolver_provider.dart'; |
| 18 import 'package:analyzer/file_system/physical_file_system.dart'; | 19 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 19 import 'package:analyzer/instrumentation/file_instrumentation.dart'; | 20 import 'package:analyzer/instrumentation/file_instrumentation.dart'; |
| 20 import 'package:analyzer/instrumentation/instrumentation.dart'; | 21 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 21 import 'package:analyzer/src/generated/engine.dart'; | 22 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 * operational. | 278 * operational. |
| 278 */ | 279 */ |
| 279 static const String SDK_OPTION = "sdk"; | 280 static const String SDK_OPTION = "sdk"; |
| 280 | 281 |
| 281 /** | 282 /** |
| 282 * The instrumentation server that is to be used by the analysis server. | 283 * The instrumentation server that is to be used by the analysis server. |
| 283 */ | 284 */ |
| 284 InstrumentationServer instrumentationServer; | 285 InstrumentationServer instrumentationServer; |
| 285 | 286 |
| 286 /** | 287 /** |
| 288 * The context manager used to create analysis contexts within each of the |
| 289 * analysis roots. |
| 290 */ |
| 291 ContextManager contextManager; |
| 292 |
| 293 /** |
| 287 * The package resolver provider used to override the way package URI's are | 294 * The package resolver provider used to override the way package URI's are |
| 288 * resolved in some contexts. | 295 * resolved in some contexts. |
| 289 */ | 296 */ |
| 297 @deprecated |
| 290 ResolverProvider packageResolverProvider; | 298 ResolverProvider packageResolverProvider; |
| 291 | 299 |
| 292 /** | 300 /** |
| 293 * The plugins that are defined outside the analysis_server package. | 301 * The plugins that are defined outside the analysis_server package. |
| 294 */ | 302 */ |
| 295 List<Plugin> _userDefinedPlugins = <Plugin>[]; | 303 List<Plugin> _userDefinedPlugins = <Plugin>[]; |
| 296 | 304 |
| 297 SocketServer socketServer; | 305 SocketServer socketServer; |
| 298 | 306 |
| 299 HttpAnalysisServer httpServer; | 307 HttpAnalysisServer httpServer; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 List<Plugin> plugins = <Plugin>[]; | 397 List<Plugin> plugins = <Plugin>[]; |
| 390 plugins.add(AnalysisEngine.instance.enginePlugin); | 398 plugins.add(AnalysisEngine.instance.enginePlugin); |
| 391 plugins.add(serverPlugin); | 399 plugins.add(serverPlugin); |
| 392 plugins.addAll(_userDefinedPlugins); | 400 plugins.addAll(_userDefinedPlugins); |
| 393 ExtensionManager manager = new ExtensionManager(); | 401 ExtensionManager manager = new ExtensionManager(); |
| 394 manager.processPlugins(plugins); | 402 manager.processPlugins(plugins); |
| 395 // | 403 // |
| 396 // Create the sockets and start listening for requests. | 404 // Create the sockets and start listening for requests. |
| 397 // | 405 // |
| 398 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, | 406 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, |
| 399 serverPlugin, packageResolverProvider); | 407 serverPlugin, contextManager, packageResolverProvider); |
| 400 httpServer = new HttpAnalysisServer(socketServer); | 408 httpServer = new HttpAnalysisServer(socketServer); |
| 401 stdioServer = new StdioAnalysisServer(socketServer); | 409 stdioServer = new StdioAnalysisServer(socketServer); |
| 402 socketServer.userDefinedPlugins = _userDefinedPlugins; | 410 socketServer.userDefinedPlugins = _userDefinedPlugins; |
| 403 | 411 |
| 404 if (serve_http) { | 412 if (serve_http) { |
| 405 httpServer.serveHttp(port); | 413 httpServer.serveHttp(port); |
| 406 } | 414 } |
| 407 | 415 |
| 408 _captureExceptions(service, () { | 416 _captureExceptions(service, () { |
| 409 stdioServer.serveStdio().then((_) { | 417 stdioServer.serveStdio().then((_) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 uuidFile.parent.createSync(recursive: true); | 552 uuidFile.parent.createSync(recursive: true); |
| 545 uuidFile.writeAsStringSync(uuid); | 553 uuidFile.writeAsStringSync(uuid); |
| 546 } catch (exception, stackTrace) { | 554 } catch (exception, stackTrace) { |
| 547 service.logPriorityException(exception, stackTrace); | 555 service.logPriorityException(exception, stackTrace); |
| 548 // Slightly alter the uuid to indicate it was not persisted | 556 // Slightly alter the uuid to indicate it was not persisted |
| 549 uuid = 'temp-$uuid'; | 557 uuid = 'temp-$uuid'; |
| 550 } | 558 } |
| 551 return uuid; | 559 return uuid; |
| 552 } | 560 } |
| 553 } | 561 } |
| OLD | NEW |