| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 /// Whether to use machine format for error display | 74 /// Whether to use machine format for error display |
| 75 final bool machineFormat; | 75 final bool machineFormat; |
| 76 | 76 |
| 77 /// The path to the package root | 77 /// The path to the package root |
| 78 final String packageRootPath; | 78 final String packageRootPath; |
| 79 | 79 |
| 80 /// The path to a `.packages` configuration file | 80 /// The path to a `.packages` configuration file |
| 81 final String packageConfigPath; | 81 final String packageConfigPath; |
| 82 | 82 |
| 83 /// The path to a file to write a performance log. |
| 84 /// (Or null if not enabled.) |
| 85 final String perfReport; |
| 86 |
| 83 /// Batch mode (for unit testing) | 87 /// Batch mode (for unit testing) |
| 84 final bool shouldBatch; | 88 final bool shouldBatch; |
| 85 | 89 |
| 86 /// Whether to show package: warnings | 90 /// Whether to show package: warnings |
| 87 final bool showPackageWarnings; | 91 final bool showPackageWarnings; |
| 88 | 92 |
| 89 /// Whether to show SDK warnings | 93 /// Whether to show SDK warnings |
| 90 final bool showSdkWarnings; | 94 final bool showSdkWarnings; |
| 91 | 95 |
| 92 /// The source files to analyze | 96 /// The source files to analyze |
| (...skipping 17 matching lines...) Expand all Loading... |
| 110 enableStrictCallChecks = args['enable-strict-call-checks'], | 114 enableStrictCallChecks = args['enable-strict-call-checks'], |
| 111 enableSuperMixins = args['supermixin'], | 115 enableSuperMixins = args['supermixin'], |
| 112 enableTypeChecks = args['enable_type_checks'], | 116 enableTypeChecks = args['enable_type_checks'], |
| 113 hintsAreFatal = args['fatal-hints'], | 117 hintsAreFatal = args['fatal-hints'], |
| 114 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 118 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
| 115 lints = args['lints'], | 119 lints = args['lints'], |
| 116 log = args['log'], | 120 log = args['log'], |
| 117 machineFormat = args['machine'] || args['format'] == 'machine', | 121 machineFormat = args['machine'] || args['format'] == 'machine', |
| 118 packageConfigPath = args['packages'], | 122 packageConfigPath = args['packages'], |
| 119 packageRootPath = args['package-root'], | 123 packageRootPath = args['package-root'], |
| 124 perfReport = args['x-perf-report'], |
| 120 shouldBatch = args['batch'], | 125 shouldBatch = args['batch'], |
| 121 showPackageWarnings = | 126 showPackageWarnings = |
| 122 args['show-package-warnings'] || args['package-warnings'], | 127 args['show-package-warnings'] || args['package-warnings'], |
| 123 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], | 128 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], |
| 124 sourceFiles = args.rest, | 129 sourceFiles = args.rest, |
| 125 warningsAreFatal = args['fatal-warnings'], | 130 warningsAreFatal = args['fatal-warnings'], |
| 126 strongMode = args['strong']; | 131 strongMode = args['strong']; |
| 127 | 132 |
| 128 /// Parse [args] into [CommandLineOptions] describing the specified | 133 /// Parse [args] into [CommandLineOptions] describing the specified |
| 129 /// analyzer options. In case of a format error, calls [printAndFail], which | 134 /// analyzer options. In case of a format error, calls [printAndFail], which |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 defaultsTo: false, | 246 defaultsTo: false, |
| 242 negatable: false) | 247 negatable: false) |
| 243 ..addFlag('warnings', | 248 ..addFlag('warnings', |
| 244 help: 'Show warnings from SDK imports.', | 249 help: 'Show warnings from SDK imports.', |
| 245 defaultsTo: false, | 250 defaultsTo: false, |
| 246 negatable: false) | 251 negatable: false) |
| 247 ..addFlag('show-sdk-warnings', | 252 ..addFlag('show-sdk-warnings', |
| 248 help: 'Show warnings from SDK imports (deprecated).', | 253 help: 'Show warnings from SDK imports (deprecated).', |
| 249 defaultsTo: false, | 254 defaultsTo: false, |
| 250 negatable: false) | 255 negatable: false) |
| 256 ..addOption('x-perf-report', |
| 257 help: 'Writes a performance report to the given file (experimental).') |
| 251 ..addFlag('help', | 258 ..addFlag('help', |
| 252 abbr: 'h', | 259 abbr: 'h', |
| 253 help: 'Display this help message.', | 260 help: 'Display this help message.', |
| 254 defaultsTo: false, | 261 defaultsTo: false, |
| 255 negatable: false) | 262 negatable: false) |
| 256 ..addOption('url-mapping', | 263 ..addOption('url-mapping', |
| 257 help: '--url-mapping=libraryUri,/path/to/library.dart directs the ' | 264 help: '--url-mapping=libraryUri,/path/to/library.dart directs the ' |
| 258 'analyzer to use "library.dart" as the source for an import ' | 265 'analyzer to use "library.dart" as the source for an import ' |
| 259 'of "libraryUri".', | 266 'of "libraryUri".', |
| 260 allowMultiple: true, | 267 allowMultiple: true, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 494 |
| 488 int _getNextFlagIndex(args, i) { | 495 int _getNextFlagIndex(args, i) { |
| 489 for (; i < args.length; ++i) { | 496 for (; i < args.length; ++i) { |
| 490 if (args[i].startsWith('--')) { | 497 if (args[i].startsWith('--')) { |
| 491 return i; | 498 return i; |
| 492 } | 499 } |
| 493 } | 500 } |
| 494 return i; | 501 return i; |
| 495 } | 502 } |
| 496 } | 503 } |
| OLD | NEW |