| 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 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 * console instead of being intercepted. | 270 * console instead of being intercepted. |
| 271 */ | 271 */ |
| 272 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console"; | 272 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console"; |
| 273 | 273 |
| 274 /** | 274 /** |
| 275 * The name of the option used to describe the new analysis driver logger. | 275 * The name of the option used to describe the new analysis driver logger. |
| 276 */ | 276 */ |
| 277 static const String NEW_ANALYSIS_DRIVER_LOG = 'new-analysis-driver-log'; | 277 static const String NEW_ANALYSIS_DRIVER_LOG = 'new-analysis-driver-log'; |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * The name of the option used to enable verbose Flutter completion code gener
ation. |
| 281 */ |
| 282 static const String VERBOSE_FLUTTER_COMPLETIONS = |
| 283 'verbose-flutter-completions'; |
| 284 |
| 285 /** |
| 280 * The name of the flag used to disable the index. | 286 * The name of the flag used to disable the index. |
| 281 */ | 287 */ |
| 282 static const String NO_INDEX = "no-index"; | 288 static const String NO_INDEX = "no-index"; |
| 283 | 289 |
| 284 /** | 290 /** |
| 285 * The name of the flag used to enable version 2 of semantic highlight | 291 * The name of the flag used to enable version 2 of semantic highlight |
| 286 * notification. | 292 * notification. |
| 287 */ | 293 */ |
| 288 static const String USE_ANALISYS_HIGHLIGHT2 = "useAnalysisHighlight2"; | 294 static const String USE_ANALISYS_HIGHLIGHT2 = "useAnalysisHighlight2"; |
| 289 | 295 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 analysisServerOptions.enableNewAnalysisDriver = | 397 analysisServerOptions.enableNewAnalysisDriver = |
| 392 !results[DISABLE_NEW_ANALYSIS_DRIVER]; | 398 !results[DISABLE_NEW_ANALYSIS_DRIVER]; |
| 393 analysisServerOptions.finerGrainedInvalidation = | 399 analysisServerOptions.finerGrainedInvalidation = |
| 394 results[FINER_GRAINED_INVALIDATION]; | 400 results[FINER_GRAINED_INVALIDATION]; |
| 395 analysisServerOptions.noIndex = results[NO_INDEX]; | 401 analysisServerOptions.noIndex = results[NO_INDEX]; |
| 396 analysisServerOptions.useAnalysisHighlight2 = | 402 analysisServerOptions.useAnalysisHighlight2 = |
| 397 results[USE_ANALISYS_HIGHLIGHT2]; | 403 results[USE_ANALISYS_HIGHLIGHT2]; |
| 398 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; | 404 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
| 399 analysisServerOptions.newAnalysisDriverLog = | 405 analysisServerOptions.newAnalysisDriverLog = |
| 400 results[NEW_ANALYSIS_DRIVER_LOG]; | 406 results[NEW_ANALYSIS_DRIVER_LOG]; |
| 407 analysisServerOptions.enableVerboseFlutterCompletions = |
| 408 results[VERBOSE_FLUTTER_COMPLETIONS]; |
| 401 | 409 |
| 402 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 410 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 403 | 411 |
| 404 // | 412 // |
| 405 // Process all of the plugins so that extensions are registered. | 413 // Process all of the plugins so that extensions are registered. |
| 406 // | 414 // |
| 407 ServerPlugin serverPlugin = new ServerPlugin(); | 415 ServerPlugin serverPlugin = new ServerPlugin(); |
| 408 List<Plugin> plugins = <Plugin>[]; | 416 List<Plugin> plugins = <Plugin>[]; |
| 409 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 417 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
| 410 plugins.add(serverPlugin); | 418 plugins.add(serverPlugin); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 negatable: false); | 565 negatable: false); |
| 558 parser.addOption(INSTRUMENTATION_LOG_FILE, | 566 parser.addOption(INSTRUMENTATION_LOG_FILE, |
| 559 help: | 567 help: |
| 560 "the path of the file to which instrumentation data will be written"
); | 568 "the path of the file to which instrumentation data will be written"
); |
| 561 parser.addFlag(INTERNAL_PRINT_TO_CONSOLE, | 569 parser.addFlag(INTERNAL_PRINT_TO_CONSOLE, |
| 562 help: "enable sending `print` output to the console", | 570 help: "enable sending `print` output to the console", |
| 563 defaultsTo: false, | 571 defaultsTo: false, |
| 564 negatable: false); | 572 negatable: false); |
| 565 parser.addOption(NEW_ANALYSIS_DRIVER_LOG, | 573 parser.addOption(NEW_ANALYSIS_DRIVER_LOG, |
| 566 help: "set a destination for the new analysis driver's log"); | 574 help: "set a destination for the new analysis driver's log"); |
| 575 parser.addOption(VERBOSE_FLUTTER_COMPLETIONS, |
| 576 help: "enable verbose code completion for Flutter (experimental)"); |
| 567 parser.addOption(PORT_OPTION, | 577 parser.addOption(PORT_OPTION, |
| 568 help: "the http diagnostic port on which the server provides" | 578 help: "the http diagnostic port on which the server provides" |
| 569 " status and performance information"); | 579 " status and performance information"); |
| 570 parser.addOption(INTERNAL_DELAY_FREQUENCY); | 580 parser.addOption(INTERNAL_DELAY_FREQUENCY); |
| 571 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 581 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
| 572 parser.addFlag(NO_INDEX, | 582 parser.addFlag(NO_INDEX, |
| 573 help: "disable indexing sources", defaultsTo: false, negatable: false); | 583 help: "disable indexing sources", defaultsTo: false, negatable: false); |
| 574 parser.addFlag(USE_ANALISYS_HIGHLIGHT2, | 584 parser.addFlag(USE_ANALISYS_HIGHLIGHT2, |
| 575 help: "enable version 2 of semantic highlight", | 585 help: "enable version 2 of semantic highlight", |
| 576 defaultsTo: false, | 586 defaultsTo: false, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 } | 669 } |
| 660 | 670 |
| 661 /** | 671 /** |
| 662 * Implements the [DiagnosticServer] class by wrapping an [HttpAnalysisServer]. | 672 * Implements the [DiagnosticServer] class by wrapping an [HttpAnalysisServer]. |
| 663 */ | 673 */ |
| 664 class _DiagnosticServerImpl extends DiagnosticServer { | 674 class _DiagnosticServerImpl extends DiagnosticServer { |
| 665 HttpAnalysisServer httpServer; | 675 HttpAnalysisServer httpServer; |
| 666 | 676 |
| 667 _DiagnosticServerImpl(); | 677 _DiagnosticServerImpl(); |
| 668 | 678 |
| 679 @override |
| 680 Future<int> getServerPort() => httpServer.serveHttp(); |
| 681 |
| 669 Future startOnPort(int port) { | 682 Future startOnPort(int port) { |
| 670 return httpServer.serveHttp(port); | 683 return httpServer.serveHttp(port); |
| 671 } | 684 } |
| 672 | |
| 673 @override | |
| 674 Future<int> getServerPort() => httpServer.serveHttp(); | |
| 675 } | 685 } |
| OLD | NEW |