Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer_cli.src.options; | 5 library analyzer_cli.src.options; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/physical_file_system.dart'; | |
| 10 import 'package:analyzer/src/command_line/arguments.dart'; | |
| 9 import 'package:analyzer_cli/src/driver.dart'; | 11 import 'package:analyzer_cli/src/driver.dart'; |
| 10 import 'package:args/args.dart'; | 12 import 'package:args/args.dart'; |
| 11 import 'package:cli_util/cli_util.dart' show getSdkDir; | 13 import 'package:cli_util/cli_util.dart' show getSdkDir; |
| 12 | 14 |
| 13 const _binaryName = 'dartanalyzer'; | 15 const _binaryName = 'dartanalyzer'; |
| 14 | 16 |
| 15 /// Shared exit handler. | 17 /// Shared exit handler. |
| 16 /// | 18 /// |
| 17 /// *Visible for testing.* | 19 /// *Visible for testing.* |
| 18 ExitHandler exitHandler = exit; | 20 ExitHandler exitHandler = exit; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 Platform.script.resolve('../../version').toFilePath(); | 268 Platform.script.resolve('../../version').toFilePath(); |
| 267 File versionFile = new File(versionPath); | 269 File versionFile = new File(versionPath); |
| 268 return versionFile.readAsStringSync().trim(); | 270 return versionFile.readAsStringSync().trim(); |
| 269 } catch (_) { | 271 } catch (_) { |
| 270 // This happens when the script is not running in the context of an SDK. | 272 // This happens when the script is not running in the context of an SDK. |
| 271 return "<unknown>"; | 273 return "<unknown>"; |
| 272 } | 274 } |
| 273 } | 275 } |
| 274 | 276 |
| 275 static CommandLineOptions _parse(List<String> args) { | 277 static CommandLineOptions _parse(List<String> args) { |
| 276 // Check if the args are in a file (bazel worker mode). | 278 args = preprocessArgs(PhysicalResourceProvider.INSTANCE, args); |
| 277 if (args.last.startsWith('@')) { | |
| 278 var argsFile = new File(args.last.substring(1)); | |
| 279 args = argsFile.readAsLinesSync(); | |
| 280 } | |
| 281 | 279 |
| 282 bool verbose = args.contains('-v') || args.contains('--verbose'); | 280 bool verbose = args.contains('-v') || args.contains('--verbose'); |
| 283 bool hide = !verbose; | 281 bool hide = !verbose; |
| 282 | |
| 283 bool verbose = args.contains('-v') || args.contains('--verbose'); | |
| 284 bool hide = !verbose; | |
|
Brian Wilkerson
2016/12/13 18:48:20
Did these lines accidentally get duplicated?
danrubel
2016/12/13 18:50:08
Yup. Missed the duplication when I merged. Removed
| |
| 284 | 285 |
| 285 args = args.expand((String arg) => arg.split('=')).toList(); | 286 args = args.expand((String arg) => arg.split('=')).toList(); |
| 286 var parser = new CommandLineParser() | 287 var parser = new CommandLineParser() |
| 287 ..addFlag('batch', | 288 ..addFlag('batch', |
| 288 abbr: 'b', | 289 abbr: 'b', |
| 289 help: 'Read commands from standard input (for testing).', | 290 help: 'Read commands from standard input (for testing).', |
| 290 defaultsTo: false, | 291 defaultsTo: false, |
| 291 negatable: false) | 292 negatable: false) |
| 292 ..addOption('dart-sdk', help: 'The path to the Dart SDK.') | 293 ..addOption('dart-sdk', help: 'The path to the Dart SDK.') |
| 293 ..addOption('dart-sdk-summary', | 294 ..addOption('dart-sdk-summary', |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 | 703 |
| 703 int _getNextFlagIndex(args, i) { | 704 int _getNextFlagIndex(args, i) { |
| 704 for (; i < args.length; ++i) { | 705 for (; i < args.length; ++i) { |
| 705 if (args[i].startsWith('--')) { | 706 if (args[i].startsWith('--')) { |
| 706 return i; | 707 return i; |
| 707 } | 708 } |
| 708 } | 709 } |
| 709 return i; | 710 return i; |
| 710 } | 711 } |
| 711 } | 712 } |
| OLD | NEW |