| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 options; | 5 library options; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 /** Whether to show performance statistics */ | 33 /** Whether to show performance statistics */ |
| 34 final bool perf; | 34 final bool perf; |
| 35 | 35 |
| 36 /** Whether to show package: warnings */ | 36 /** Whether to show package: warnings */ |
| 37 final bool showPackageWarnings; | 37 final bool showPackageWarnings; |
| 38 | 38 |
| 39 /** Whether to show SDK warnings */ | 39 /** Whether to show SDK warnings */ |
| 40 final bool showSdkWarnings; | 40 final bool showSdkWarnings; |
| 41 | 41 |
| 42 /** Whether to show both cold and hot performance statistics */ |
| 43 final bool warmPerf; |
| 44 |
| 42 /** Whether to treat warnings as fatal */ | 45 /** Whether to treat warnings as fatal */ |
| 43 final bool warningsAreFatal; | 46 final bool warningsAreFatal; |
| 44 | 47 |
| 45 /** The path to the dart SDK */ | 48 /** The path to the dart SDK */ |
| 46 final String dartSdkPath; | 49 final String dartSdkPath; |
| 47 | 50 |
| 48 /** The path to the package root */ | 51 /** The path to the package root */ |
| 49 final String packageRootPath; | 52 final String packageRootPath; |
| 50 | 53 |
| 51 /** The source files to analyze */ | 54 /** The source files to analyze */ |
| 52 final List<String> sourceFiles; | 55 final List<String> sourceFiles; |
| 53 | 56 |
| 54 /** Whether to log additional analysis messages and exceptions */ | 57 /** Whether to log additional analysis messages and exceptions */ |
| 55 final bool log; | 58 final bool log; |
| 56 | 59 |
| 57 /** | 60 /** |
| 58 * Initialize options from the given parsed [args]. | 61 * Initialize options from the given parsed [args]. |
| 59 */ | 62 */ |
| 60 CommandLineOptions._fromArgs(ArgResults args) | 63 CommandLineOptions._fromArgs(ArgResults args) |
| 61 : shouldBatch = args['batch'], | 64 : shouldBatch = args['batch'], |
| 62 machineFormat = args['machine'] || args['format'] == 'machine', | 65 machineFormat = args['machine'] || args['format'] == 'machine', |
| 63 displayVersion = args['version'], | 66 displayVersion = args['version'], |
| 64 disableHints = args['no-hints'], | 67 disableHints = args['no-hints'], |
| 65 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 68 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
| 66 perf = args['perf'], | 69 perf = args['perf'], |
| 67 showPackageWarnings = args['show-package-warnings'] || args['package-warni
ngs'], | 70 showPackageWarnings = args['show-package-warnings'] || args['package-warni
ngs'], |
| 68 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], | 71 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], |
| 72 warmPerf = args['warm-perf'], |
| 69 warningsAreFatal = args['fatal-warnings'], | 73 warningsAreFatal = args['fatal-warnings'], |
| 70 dartSdkPath = args['dart-sdk'], | 74 dartSdkPath = args['dart-sdk'], |
| 71 packageRootPath = args['package-root'], | 75 packageRootPath = args['package-root'], |
| 72 log = args['log'], | 76 log = args['log'], |
| 73 sourceFiles = args.rest; | 77 sourceFiles = args.rest; |
| 74 | 78 |
| 75 /** | 79 /** |
| 76 * Parse [args] into [CommandLineOptions] describing the specified | 80 * Parse [args] into [CommandLineOptions] describing the specified |
| 77 * analyzer options. In case of a format error, prints error and exists. | 81 * analyzer options. In case of a format error, prints error and exists. |
| 78 */ | 82 */ |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 defaultsTo: false, negatable: false) | 124 defaultsTo: false, negatable: false) |
| 121 ..addFlag('package-warnings', | 125 ..addFlag('package-warnings', |
| 122 help: 'Show warnings from package: imports', | 126 help: 'Show warnings from package: imports', |
| 123 defaultsTo: false, negatable: false) | 127 defaultsTo: false, negatable: false) |
| 124 ..addFlag('show-package-warnings', | 128 ..addFlag('show-package-warnings', |
| 125 help: 'Show warnings from package: imports (deprecated)', | 129 help: 'Show warnings from package: imports (deprecated)', |
| 126 defaultsTo: false, negatable: false) | 130 defaultsTo: false, negatable: false) |
| 127 ..addFlag('perf', | 131 ..addFlag('perf', |
| 128 help: 'Show performance statistics', | 132 help: 'Show performance statistics', |
| 129 defaultsTo: false, negatable: false) | 133 defaultsTo: false, negatable: false) |
| 134 ..addFlag('warm-perf', |
| 135 help: 'Show both cold and warm performance statistics', |
| 136 defaultsTo: false, negatable: false, hide: true) |
| 130 ..addFlag('warnings', help: 'Show warnings from SDK imports', | 137 ..addFlag('warnings', help: 'Show warnings from SDK imports', |
| 131 defaultsTo: false, negatable: false) | 138 defaultsTo: false, negatable: false) |
| 132 ..addFlag('show-sdk-warnings', help: 'Show warnings from SDK imports (depr
ecated)', | 139 ..addFlag('show-sdk-warnings', help: 'Show warnings from SDK imports (depr
ecated)', |
| 133 defaultsTo: false, negatable: false) | 140 defaultsTo: false, negatable: false) |
| 134 ..addFlag('help', abbr: 'h', help: 'Display this help message', | 141 ..addFlag('help', abbr: 'h', help: 'Display this help message', |
| 135 defaultsTo: false, negatable: false) | 142 defaultsTo: false, negatable: false) |
| 136 ..addFlag('log', help: 'Log additional messages and exceptions', | 143 ..addFlag('log', help: 'Log additional messages and exceptions', |
| 137 defaultsTo: false, negatable: false, hide: true); | 144 defaultsTo: false, negatable: false, hide: true); |
| 138 | 145 |
| 139 try { | 146 try { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 288 |
| 282 _getNextFlagIndex(args, i) { | 289 _getNextFlagIndex(args, i) { |
| 283 for ( ; i < args.length; ++i) { | 290 for ( ; i < args.length; ++i) { |
| 284 if (args[i].startsWith('--')) { | 291 if (args[i].startsWith('--')) { |
| 285 return i; | 292 return i; |
| 286 } | 293 } |
| 287 } | 294 } |
| 288 return i; | 295 return i; |
| 289 } | 296 } |
| 290 } | 297 } |
| OLD | NEW |