| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 * operational. | 125 * operational. |
| 126 */ | 126 */ |
| 127 static const String SDK_OPTION = "sdk"; | 127 static const String SDK_OPTION = "sdk"; |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * The name of the flag used to disable error notifications. | 130 * The name of the flag used to disable error notifications. |
| 131 */ | 131 */ |
| 132 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; | 132 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * The name of the flag used to disable the index. |
| 136 */ |
| 137 static const String NO_INDEX = "no-index"; |
| 138 |
| 139 /** |
| 135 * The name of the option used to set the file read mode. | 140 * The name of the option used to set the file read mode. |
| 136 */ | 141 */ |
| 137 static const String FILE_READ_MODE = "file-read-mode"; | 142 static const String FILE_READ_MODE = "file-read-mode"; |
| 138 | 143 |
| 139 /** | 144 /** |
| 140 * The instrumentation server that is to be used by the analysis server. | 145 * The instrumentation server that is to be used by the analysis server. |
| 141 */ | 146 */ |
| 142 InstrumentationServer instrumentationServer; | 147 InstrumentationServer instrumentationServer; |
| 143 | 148 |
| 144 /** | 149 /** |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 return; | 216 return; |
| 212 } | 217 } |
| 213 } | 218 } |
| 214 | 219 |
| 215 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 220 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 216 analysisServerOptions.enableIncrementalResolutionApi = | 221 analysisServerOptions.enableIncrementalResolutionApi = |
| 217 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 222 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
| 218 analysisServerOptions.enableIncrementalResolutionValidation = | 223 analysisServerOptions.enableIncrementalResolutionValidation = |
| 219 results[INCREMENTAL_RESOLUTION_VALIDATION]; | 224 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
| 220 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; | 225 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; |
| 226 analysisServerOptions.noIndex = results[NO_INDEX]; |
| 221 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; | 227 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
| 222 | 228 |
| 223 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 229 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 224 | 230 |
| 225 DartSdk defaultSdk; | 231 DartSdk defaultSdk; |
| 226 if (results[SDK_OPTION] != null) { | 232 if (results[SDK_OPTION] != null) { |
| 227 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 233 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 228 } else { | 234 } else { |
| 229 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 235 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| 230 // which will make a guess. | 236 // which will make a guess. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 parser.addOption( | 346 parser.addOption( |
| 341 PORT_OPTION, | 347 PORT_OPTION, |
| 342 help: "[port] the port on which the server will listen"); | 348 help: "[port] the port on which the server will listen"); |
| 343 parser.addOption(INTERNAL_DELAY_FREQUENCY); | 349 parser.addOption(INTERNAL_DELAY_FREQUENCY); |
| 344 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 350 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
| 345 parser.addFlag( | 351 parser.addFlag( |
| 346 NO_ERROR_NOTIFICATION, | 352 NO_ERROR_NOTIFICATION, |
| 347 help: "disable sending all analysis error notifications to the server", | 353 help: "disable sending all analysis error notifications to the server", |
| 348 defaultsTo: false, | 354 defaultsTo: false, |
| 349 negatable: false); | 355 negatable: false); |
| 356 parser.addFlag( |
| 357 NO_INDEX, |
| 358 help: "disable indexing sources", |
| 359 defaultsTo: false, |
| 360 negatable: false); |
| 350 parser.addOption( | 361 parser.addOption( |
| 351 FILE_READ_MODE, | 362 FILE_READ_MODE, |
| 352 help: "an option of the ways files can be read from disk, " + | 363 help: "an option of the ways files can be read from disk, " + |
| 353 "some clients normalize end of line characters which would make " + | 364 "some clients normalize end of line characters which would make " + |
| 354 "the file offset and range information incorrect.", | 365 "the file offset and range information incorrect.", |
| 355 allowed: ["as-is", "normalize-eol-always"], | 366 allowed: ["as-is", "normalize-eol-always"], |
| 356 allowedHelp: { | 367 allowedHelp: { |
| 357 "as-is": "file contents are read as-is, no file changes occur", | 368 "as-is": "file contents are read as-is, no file changes occur", |
| 358 "normalize-eol-always": | 369 "normalize-eol-always": |
| 359 r'file contents normalize the end of line characters to the single cha
racter new line `\n`' | 370 r'file contents normalize the end of line characters to the single cha
racter new line `\n`' |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 uuidFile.parent.createSync(recursive: true); | 407 uuidFile.parent.createSync(recursive: true); |
| 397 uuidFile.writeAsStringSync(uuid); | 408 uuidFile.writeAsStringSync(uuid); |
| 398 } catch (exception, stackTrace) { | 409 } catch (exception, stackTrace) { |
| 399 service.logPriorityException(exception, stackTrace); | 410 service.logPriorityException(exception, stackTrace); |
| 400 // Slightly alter the uuid to indicate it was not persisted | 411 // Slightly alter the uuid to indicate it was not persisted |
| 401 uuid = 'temp-$uuid'; | 412 uuid = 'temp-$uuid'; |
| 402 } | 413 } |
| 403 return uuid; | 414 return uuid; |
| 404 } | 415 } |
| 405 } | 416 } |
| OLD | NEW |