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 perfLog; | |
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 perfLog = args['perf-log'], | |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 ..addFlag('fatal-hints', | 234 ..addFlag('fatal-hints', |
230 help: 'Treat hints as fatal.', defaultsTo: false, negatable: false) | 235 help: 'Treat hints as fatal.', defaultsTo: false, negatable: false) |
231 ..addFlag('fatal-warnings', | 236 ..addFlag('fatal-warnings', |
232 help: 'Treat non-type warnings as fatal.', | 237 help: 'Treat non-type warnings as fatal.', |
233 defaultsTo: false, | 238 defaultsTo: false, |
234 negatable: false) | 239 negatable: false) |
235 ..addFlag('package-warnings', | 240 ..addFlag('package-warnings', |
236 help: 'Show warnings from package: imports.', | 241 help: 'Show warnings from package: imports.', |
237 defaultsTo: false, | 242 defaultsTo: false, |
238 negatable: false) | 243 negatable: false) |
244 ..addOption('perf-log', | |
Brian Wilkerson
2015/12/16 15:08:43
I think I'd prefer to not have this be visible in
skybrian
2015/12/16 18:48:10
For GWT there are compiler flags that are explicit
Brian Wilkerson
2015/12/16 19:06:45
That would be fine. I just want it to be obvious t
| |
245 help: 'Writes a performance log to the given file.') | |
239 ..addFlag('show-package-warnings', | 246 ..addFlag('show-package-warnings', |
240 help: 'Show warnings from package: imports (deprecated).', | 247 help: 'Show warnings from package: imports (deprecated).', |
241 defaultsTo: false, | 248 defaultsTo: false, |
242 negatable: false) | 249 negatable: false) |
243 ..addFlag('warnings', | 250 ..addFlag('warnings', |
244 help: 'Show warnings from SDK imports.', | 251 help: 'Show warnings from SDK imports.', |
245 defaultsTo: false, | 252 defaultsTo: false, |
246 negatable: false) | 253 negatable: false) |
247 ..addFlag('show-sdk-warnings', | 254 ..addFlag('show-sdk-warnings', |
248 help: 'Show warnings from SDK imports (deprecated).', | 255 help: 'Show warnings from SDK imports (deprecated).', |
(...skipping 238 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 |