| 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 | 9 |
| 10 import 'package:analysis_server/plugin/plugin.dart'; | 10 import 'package:analysis_server/plugin/plugin.dart'; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 static const String PORT_OPTION = "port"; | 108 static const String PORT_OPTION = "port"; |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * The path to the SDK. | 111 * The path to the SDK. |
| 112 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is | 112 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is |
| 113 * operational. | 113 * operational. |
| 114 */ | 114 */ |
| 115 static const String SDK_OPTION = "sdk"; | 115 static const String SDK_OPTION = "sdk"; |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * The name of the option used to disable error notifications. | 118 * The name of the flag used to disable error notifications. |
| 119 */ | 119 */ |
| 120 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; | 120 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * The name of the option used to set the file read mode. |
| 124 */ |
| 125 static const String FILE_READ_MODE = "file-read-mode"; |
| 126 |
| 127 /** |
| 123 * The instrumentation server that is to be used by the analysis server. | 128 * The instrumentation server that is to be used by the analysis server. |
| 124 */ | 129 */ |
| 125 InstrumentationServer instrumentationServer; | 130 InstrumentationServer instrumentationServer; |
| 126 | 131 |
| 127 /** | 132 /** |
| 128 * The plugins that are defined outside the analysis_server package. | 133 * The plugins that are defined outside the analysis_server package. |
| 129 */ | 134 */ |
| 130 List<Plugin> _userDefinedPlugins = <Plugin>[]; | 135 List<Plugin> _userDefinedPlugins = <Plugin>[]; |
| 131 | 136 |
| 132 SocketServer socketServer; | 137 SocketServer socketServer; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return; | 192 return; |
| 188 } | 193 } |
| 189 } | 194 } |
| 190 | 195 |
| 191 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 196 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 192 analysisServerOptions.enableIncrementalResolutionApi = | 197 analysisServerOptions.enableIncrementalResolutionApi = |
| 193 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 198 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
| 194 analysisServerOptions.enableIncrementalResolutionValidation = | 199 analysisServerOptions.enableIncrementalResolutionValidation = |
| 195 results[INCREMENTAL_RESOLUTION_VALIDATION]; | 200 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
| 196 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; | 201 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; |
| 202 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
| 197 | 203 |
| 198 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 204 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 199 | 205 |
| 200 DartSdk defaultSdk; | 206 DartSdk defaultSdk; |
| 201 if (results[SDK_OPTION] != null) { | 207 if (results[SDK_OPTION] != null) { |
| 202 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 208 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 203 } else { | 209 } else { |
| 204 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 210 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| 205 // which will make a guess. | 211 // which will make a guess. |
| 206 defaultSdk = DirectoryBasedDartSdk.defaultSdk; | 212 defaultSdk = DirectoryBasedDartSdk.defaultSdk; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 INTERNAL_PRINT_TO_CONSOLE, | 311 INTERNAL_PRINT_TO_CONSOLE, |
| 306 help: "enable sending `print` output to the console", | 312 help: "enable sending `print` output to the console", |
| 307 defaultsTo: false, | 313 defaultsTo: false, |
| 308 negatable: false); | 314 negatable: false); |
| 309 parser.addOption( | 315 parser.addOption( |
| 310 PORT_OPTION, | 316 PORT_OPTION, |
| 311 help: "[port] the port on which the server will listen"); | 317 help: "[port] the port on which the server will listen"); |
| 312 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 318 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
| 313 parser.addFlag( | 319 parser.addFlag( |
| 314 NO_ERROR_NOTIFICATION, | 320 NO_ERROR_NOTIFICATION, |
| 315 help: | 321 help: "disable sending all analysis error notifications to the server", |
| 316 "disable sending all analysis error notifications to the server", | |
| 317 defaultsTo: false, | 322 defaultsTo: false, |
| 318 negatable: false); | 323 negatable: false); |
| 324 parser.addOption( |
| 325 FILE_READ_MODE, |
| 326 help: "an option of the ways files can be read from disk, " + |
| 327 "some clients normalize end of line characters which would make " + |
| 328 "the file offset and range information incorrect.", |
| 329 allowed: ["as-is", "normalize-eol"], |
| 330 allowedHelp: { |
| 331 "as-is": "file contents are read as-is, no file changes occur", |
| 332 "normalize-eol": |
| 333 "file contents normalize the end of line characters to the single char
acter new line `\n`" |
| 334 }, defaultsTo: "as-is"); |
| 319 | 335 |
| 320 return parser; | 336 return parser; |
| 321 } | 337 } |
| 322 | 338 |
| 323 /** | 339 /** |
| 324 * Print information about how to use the server. | 340 * Print information about how to use the server. |
| 325 */ | 341 */ |
| 326 void _printUsage(ArgParser parser) { | 342 void _printUsage(ArgParser parser) { |
| 327 print('Usage: $BINARY_NAME [flags]'); | 343 print('Usage: $BINARY_NAME [flags]'); |
| 328 print(''); | 344 print(''); |
| 329 print('Supported flags are:'); | 345 print('Supported flags are:'); |
| 330 print(parser.usage); | 346 print(parser.usage); |
| 331 } | 347 } |
| 332 } | 348 } |
| OLD | NEW |