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'; | 9 import 'package:analyzer/file_system/physical_file_system.dart'; |
10 import 'package:analyzer/src/command_line/arguments.dart'; | 10 import 'package:analyzer/src/command_line/arguments.dart'; |
(...skipping 15 matching lines...) Expand all Loading... |
26 exitHandler(exitCode); | 26 exitHandler(exitCode); |
27 } | 27 } |
28 | 28 |
29 /// Exit handler. | 29 /// Exit handler. |
30 /// | 30 /// |
31 /// *Visible for testing.* | 31 /// *Visible for testing.* |
32 typedef void ExitHandler(int code); | 32 typedef void ExitHandler(int code); |
33 | 33 |
34 /// Analyzer commandline configuration options. | 34 /// Analyzer commandline configuration options. |
35 class CommandLineOptions { | 35 class CommandLineOptions { |
36 final bool enableNewAnalysisDriver = false; | 36 final bool enableNewAnalysisDriver = true; |
37 | 37 |
38 /// The path to output analysis results when in build mode. | 38 /// The path to output analysis results when in build mode. |
39 final String buildAnalysisOutput; | 39 final String buildAnalysisOutput; |
40 | 40 |
41 /// Whether to use build mode. | 41 /// Whether to use build mode. |
42 final bool buildMode; | 42 final bool buildMode; |
43 | 43 |
44 /// Whether to use build mode as a Bazel persistent worker. | 44 /// Whether to use build mode as a Bazel persistent worker. |
45 final bool buildModePersistentWorker; | 45 final bool buildModePersistentWorker; |
46 | 46 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 /// Whether implicit casts are enabled (in strong mode) | 137 /// Whether implicit casts are enabled (in strong mode) |
138 final bool implicitCasts; | 138 final bool implicitCasts; |
139 | 139 |
140 /// Whether implicit dynamic is enabled (mainly for strong mode users) | 140 /// Whether implicit dynamic is enabled (mainly for strong mode users) |
141 final bool implicitDynamic; | 141 final bool implicitDynamic; |
142 | 142 |
143 /// Whether to treat lints as fatal | 143 /// Whether to treat lints as fatal |
144 final bool lintsAreFatal; | 144 final bool lintsAreFatal; |
145 | 145 |
| 146 /// Whether to use memory byte store for analysis driver. |
| 147 final bool useAnalysisDriverMemoryByteStore; |
| 148 |
146 /// Initialize options from the given parsed [args]. | 149 /// Initialize options from the given parsed [args]. |
147 CommandLineOptions._fromArgs(ArgResults args) | 150 CommandLineOptions._fromArgs(ArgResults args) |
148 : buildAnalysisOutput = args['build-analysis-output'], | 151 : buildAnalysisOutput = args['build-analysis-output'], |
149 buildMode = args['build-mode'], | 152 buildMode = args['build-mode'], |
150 buildModePersistentWorker = args['persistent_worker'], | 153 buildModePersistentWorker = args['persistent_worker'], |
151 buildSummaryInputs = args['build-summary-input'] as List<String>, | 154 buildSummaryInputs = args['build-summary-input'] as List<String>, |
152 buildSummaryOnly = args['build-summary-only'], | 155 buildSummaryOnly = args['build-summary-only'], |
153 buildSummaryOnlyDiet = args['build-summary-only-diet'], | 156 buildSummaryOnlyDiet = args['build-summary-only-diet'], |
154 buildSummaryExcludeInformative = | 157 buildSummaryExcludeInformative = |
155 args['build-summary-exclude-informative'], | 158 args['build-summary-exclude-informative'], |
(...skipping 18 matching lines...) Expand all Loading... |
174 showPackageWarnings = args['show-package-warnings'] || | 177 showPackageWarnings = args['show-package-warnings'] || |
175 args['package-warnings'] || | 178 args['package-warnings'] || |
176 args['x-package-warnings-prefix'] != null, | 179 args['x-package-warnings-prefix'] != null, |
177 showPackageWarningsPrefix = args['x-package-warnings-prefix'], | 180 showPackageWarningsPrefix = args['x-package-warnings-prefix'], |
178 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], | 181 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], |
179 sourceFiles = args.rest, | 182 sourceFiles = args.rest, |
180 warningsAreFatal = args['fatal-warnings'], | 183 warningsAreFatal = args['fatal-warnings'], |
181 strongMode = args['strong'], | 184 strongMode = args['strong'], |
182 implicitCasts = !args['no-implicit-casts'], | 185 implicitCasts = !args['no-implicit-casts'], |
183 implicitDynamic = !args['no-implicit-dynamic'], | 186 implicitDynamic = !args['no-implicit-dynamic'], |
184 lintsAreFatal = args['fatal-lints']; | 187 lintsAreFatal = args['fatal-lints'], |
| 188 useAnalysisDriverMemoryByteStore = |
| 189 args['use-analysis-driver-memory-byte-store']; |
185 | 190 |
186 /// The path to an analysis options file | 191 /// The path to an analysis options file |
187 String get analysisOptionsFile => | 192 String get analysisOptionsFile => |
188 contextBuilderOptions.defaultAnalysisOptionsFilePath; | 193 contextBuilderOptions.defaultAnalysisOptionsFilePath; |
189 | 194 |
190 /// A table mapping the names of defined variables to their values. | 195 /// A table mapping the names of defined variables to their values. |
191 Map<String, String> get definedVariables => | 196 Map<String, String> get definedVariables => |
192 contextBuilderOptions.declaredVariables; | 197 contextBuilderOptions.declaredVariables; |
193 | 198 |
194 /// Whether to strictly follow the specification when generating warnings on | 199 /// Whether to strictly follow the specification when generating warnings on |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 hide: hide) | 451 hide: hide) |
447 ..addFlag('log', | 452 ..addFlag('log', |
448 help: 'Log additional messages and exceptions.', | 453 help: 'Log additional messages and exceptions.', |
449 defaultsTo: false, | 454 defaultsTo: false, |
450 negatable: false, | 455 negatable: false, |
451 hide: hide) | 456 hide: hide) |
452 ..addFlag('enable_type_checks', | 457 ..addFlag('enable_type_checks', |
453 help: 'Check types in constant evaluation.', | 458 help: 'Check types in constant evaluation.', |
454 defaultsTo: false, | 459 defaultsTo: false, |
455 negatable: false, | 460 negatable: false, |
| 461 hide: hide) |
| 462 ..addFlag('use-analysis-driver-memory-byte-store', |
| 463 help: 'Use memory byte store, not the file system cache.', |
| 464 defaultsTo: false, |
| 465 negatable: false, |
456 hide: hide); | 466 hide: hide); |
457 | 467 |
458 try { | 468 try { |
459 // TODO(scheglov) https://code.google.com/p/dart/issues/detail?id=11061 | 469 // TODO(scheglov) https://code.google.com/p/dart/issues/detail?id=11061 |
460 args = | 470 args = |
461 args.map((String arg) => arg == '-batch' ? '--batch' : arg).toList(); | 471 args.map((String arg) => arg == '-batch' ? '--batch' : arg).toList(); |
462 if (args.contains('--$ignoreUnrecognizedFlagsFlag')) { | 472 if (args.contains('--$ignoreUnrecognizedFlagsFlag')) { |
463 args = filterUnknownArguments(args, parser); | 473 args = filterUnknownArguments(args, parser); |
464 } | 474 } |
465 var results = parser.parse(args); | 475 var results = parser.parse(args); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 539 |
530 static _showUsage(parser) { | 540 static _showUsage(parser) { |
531 errorSink | 541 errorSink |
532 .writeln('Usage: $_binaryName [options...] <libraries to analyze...>'); | 542 .writeln('Usage: $_binaryName [options...] <libraries to analyze...>'); |
533 errorSink.writeln(parser.getUsage()); | 543 errorSink.writeln(parser.getUsage()); |
534 errorSink.writeln(''); | 544 errorSink.writeln(''); |
535 errorSink.writeln( | 545 errorSink.writeln( |
536 'For more information, see http://www.dartlang.org/tools/analyzer.'); | 546 'For more information, see http://www.dartlang.org/tools/analyzer.'); |
537 } | 547 } |
538 } | 548 } |
OLD | NEW |