| 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_cli/src/driver.dart'; | 9 import 'package:analyzer_cli/src/driver.dart'; |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 Platform.script.resolve('../../version').toFilePath(); | 256 Platform.script.resolve('../../version').toFilePath(); |
| 257 File versionFile = new File(versionPath); | 257 File versionFile = new File(versionPath); |
| 258 return versionFile.readAsStringSync().trim(); | 258 return versionFile.readAsStringSync().trim(); |
| 259 } catch (_) { | 259 } catch (_) { |
| 260 // This happens when the script is not running in the context of an SDK. | 260 // This happens when the script is not running in the context of an SDK. |
| 261 return "<unknown>"; | 261 return "<unknown>"; |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 static CommandLineOptions _parse(List<String> args) { | 265 static CommandLineOptions _parse(List<String> args) { |
| 266 // Check if the args are in a file (bazel worker mode). |
| 267 if (args.last.startsWith('@')) { |
| 268 var argsFile = new File(args.last.substring(1)); |
| 269 args = argsFile.readAsLinesSync(); |
| 270 } |
| 271 |
| 266 args = args.expand((String arg) => arg.split('=')).toList(); | 272 args = args.expand((String arg) => arg.split('=')).toList(); |
| 267 var parser = new CommandLineParser() | 273 var parser = new CommandLineParser() |
| 268 ..addFlag('batch', | 274 ..addFlag('batch', |
| 269 abbr: 'b', | 275 abbr: 'b', |
| 270 help: 'Read commands from standard input (for testing).', | 276 help: 'Read commands from standard input (for testing).', |
| 271 defaultsTo: false, | 277 defaultsTo: false, |
| 272 negatable: false) | 278 negatable: false) |
| 273 ..addOption('dart-sdk', help: 'The path to the Dart SDK.') | 279 ..addOption('dart-sdk', help: 'The path to the Dart SDK.') |
| 274 ..addOption('packages', | 280 ..addOption('packages', |
| 275 help: | 281 help: |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 659 |
| 654 int _getNextFlagIndex(args, i) { | 660 int _getNextFlagIndex(args, i) { |
| 655 for (; i < args.length; ++i) { | 661 for (; i < args.length; ++i) { |
| 656 if (args[i].startsWith('--')) { | 662 if (args[i].startsWith('--')) { |
| 657 return i; | 663 return i; |
| 658 } | 664 } |
| 659 } | 665 } |
| 660 return i; | 666 return i; |
| 661 } | 667 } |
| 662 } | 668 } |
| OLD | NEW |