| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 static const String PORT_OPTION = "port"; | 115 static const String PORT_OPTION = "port"; |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * The path to the SDK. | 118 * The path to the SDK. |
| 119 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is | 119 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is |
| 120 * operational. | 120 * operational. |
| 121 */ | 121 */ |
| 122 static const String SDK_OPTION = "sdk"; | 122 static const String SDK_OPTION = "sdk"; |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * The name of the option used to disable error notifications. | 125 * The name of the flag used to disable error notifications. |
| 126 */ | 126 */ |
| 127 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; | 127 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * The name of the option used to set the file read mode. |
| 131 */ |
| 132 static const String FILE_READ_MODE = "file-read-mode"; |
| 133 |
| 134 /** |
| 130 * The instrumentation server that is to be used by the analysis server. | 135 * The instrumentation server that is to be used by the analysis server. |
| 131 */ | 136 */ |
| 132 InstrumentationServer instrumentationServer; | 137 InstrumentationServer instrumentationServer; |
| 133 | 138 |
| 134 /** | 139 /** |
| 135 * The plugins that are defined outside the analysis_server package. | 140 * The plugins that are defined outside the analysis_server package. |
| 136 */ | 141 */ |
| 137 List<Plugin> _userDefinedPlugins = <Plugin>[]; | 142 List<Plugin> _userDefinedPlugins = <Plugin>[]; |
| 138 | 143 |
| 139 SocketServer socketServer; | 144 SocketServer socketServer; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return; | 199 return; |
| 195 } | 200 } |
| 196 } | 201 } |
| 197 | 202 |
| 198 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 203 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 199 analysisServerOptions.enableIncrementalResolutionApi = | 204 analysisServerOptions.enableIncrementalResolutionApi = |
| 200 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 205 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
| 201 analysisServerOptions.enableIncrementalResolutionValidation = | 206 analysisServerOptions.enableIncrementalResolutionValidation = |
| 202 results[INCREMENTAL_RESOLUTION_VALIDATION]; | 207 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
| 203 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; | 208 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; |
| 209 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
| 204 | 210 |
| 205 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 211 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 206 | 212 |
| 207 DartSdk defaultSdk; | 213 DartSdk defaultSdk; |
| 208 if (results[SDK_OPTION] != null) { | 214 if (results[SDK_OPTION] != null) { |
| 209 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 215 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 210 } else { | 216 } else { |
| 211 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 217 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| 212 // which will make a guess. | 218 // which will make a guess. |
| 213 defaultSdk = DirectoryBasedDartSdk.defaultSdk; | 219 defaultSdk = DirectoryBasedDartSdk.defaultSdk; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 negatable: false); | 327 negatable: false); |
| 322 parser.addOption( | 328 parser.addOption( |
| 323 PORT_OPTION, | 329 PORT_OPTION, |
| 324 help: "[port] the port on which the server will listen"); | 330 help: "[port] the port on which the server will listen"); |
| 325 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 331 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
| 326 parser.addFlag( | 332 parser.addFlag( |
| 327 NO_ERROR_NOTIFICATION, | 333 NO_ERROR_NOTIFICATION, |
| 328 help: "disable sending all analysis error notifications to the server", | 334 help: "disable sending all analysis error notifications to the server", |
| 329 defaultsTo: false, | 335 defaultsTo: false, |
| 330 negatable: false); | 336 negatable: false); |
| 337 parser.addOption( |
| 338 FILE_READ_MODE, |
| 339 help: "an option of the ways files can be read from disk, " + |
| 340 "some clients normalize end of line characters which would make " + |
| 341 "the file offset and range information incorrect.", |
| 342 allowed: ["as-is", "normalize-eol-always"], |
| 343 allowedHelp: { |
| 344 "as-is": "file contents are read as-is, no file changes occur", |
| 345 "normalize-eol-always": |
| 346 "file contents normalize the end of line characters to the single char
acter new line `\n`" |
| 347 }, defaultsTo: "as-is"); |
| 331 | 348 |
| 332 return parser; | 349 return parser; |
| 333 } | 350 } |
| 334 | 351 |
| 335 /** | 352 /** |
| 336 * Print information about how to use the server. | 353 * Print information about how to use the server. |
| 337 */ | 354 */ |
| 338 void _printUsage(ArgParser parser) { | 355 void _printUsage(ArgParser parser) { |
| 339 print('Usage: $BINARY_NAME [flags]'); | 356 print('Usage: $BINARY_NAME [flags]'); |
| 340 print(''); | 357 print(''); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 366 uuidFile.parent.createSync(recursive: true); | 383 uuidFile.parent.createSync(recursive: true); |
| 367 uuidFile.writeAsStringSync(uuid); | 384 uuidFile.writeAsStringSync(uuid); |
| 368 } catch (exception, stackTrace) { | 385 } catch (exception, stackTrace) { |
| 369 service.logPriorityException(exception, stackTrace); | 386 service.logPriorityException(exception, stackTrace); |
| 370 // Slightly alter the uuid to indicate it was not persisted | 387 // Slightly alter the uuid to indicate it was not persisted |
| 371 uuid = 'temp-$uuid'; | 388 uuid = 'temp-$uuid'; |
| 372 } | 389 } |
| 373 return uuid; | 390 return uuid; |
| 374 } | 391 } |
| 375 } | 392 } |
| OLD | NEW |