| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 /// Exit handler. | 30 /// Exit handler. |
| 31 /// | 31 /// |
| 32 /// *Visible for testing.* | 32 /// *Visible for testing.* |
| 33 typedef void ExitHandler(int code); | 33 typedef void ExitHandler(int code); |
| 34 | 34 |
| 35 /// Analyzer commandline configuration options. | 35 /// Analyzer commandline configuration options. |
| 36 class CommandLineOptions { | 36 class CommandLineOptions { |
| 37 final bool enableNewAnalysisDriver = true; | 37 final bool enableNewAnalysisDriver = true; |
| 38 | 38 |
| 39 /// Return `true` if the parser is to parse asserts in the initializer list of |
| 40 /// a constructor. |
| 41 final bool enableAssertInitializer; |
| 42 |
| 39 /// The path to output analysis results when in build mode. | 43 /// The path to output analysis results when in build mode. |
| 40 final String buildAnalysisOutput; | 44 final String buildAnalysisOutput; |
| 41 | 45 |
| 42 /// Whether to use build mode. | 46 /// Whether to use build mode. |
| 43 final bool buildMode; | 47 final bool buildMode; |
| 44 | 48 |
| 45 /// Whether to use build mode as a Bazel persistent worker. | 49 /// Whether to use build mode as a Bazel persistent worker. |
| 46 final bool buildModePersistentWorker; | 50 final bool buildModePersistentWorker; |
| 47 | 51 |
| 48 /// List of summary file paths to use in build mode. | 52 /// List of summary file paths to use in build mode. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 buildSummaryOutput = args['build-summary-output'], | 167 buildSummaryOutput = args['build-summary-output'], |
| 164 buildSummaryOutputSemantic = args['build-summary-output-semantic'], | 168 buildSummaryOutputSemantic = args['build-summary-output-semantic'], |
| 165 buildSuppressExitCode = args['build-suppress-exit-code'], | 169 buildSuppressExitCode = args['build-suppress-exit-code'], |
| 166 contextBuilderOptions = createContextBuilderOptions(args), | 170 contextBuilderOptions = createContextBuilderOptions(args), |
| 167 dartSdkPath = args['dart-sdk'], | 171 dartSdkPath = args['dart-sdk'], |
| 168 dartSdkSummaryPath = args['dart-sdk-summary'], | 172 dartSdkSummaryPath = args['dart-sdk-summary'], |
| 169 disableCacheFlushing = args['disable-cache-flushing'], | 173 disableCacheFlushing = args['disable-cache-flushing'], |
| 170 disableHints = args['no-hints'], | 174 disableHints = args['no-hints'], |
| 171 displayVersion = args['version'], | 175 displayVersion = args['version'], |
| 172 enableTypeChecks = args['enable_type_checks'], | 176 enableTypeChecks = args['enable_type_checks'], |
| 177 enableAssertInitializer = args['enable-assert-initializers'], |
| 173 hintsAreFatal = args['fatal-hints'], | 178 hintsAreFatal = args['fatal-hints'], |
| 174 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 179 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
| 175 lints = args[lintsFlag], | 180 lints = args[lintsFlag], |
| 176 log = args['log'], | 181 log = args['log'], |
| 177 machineFormat = args['format'] == 'machine', | 182 machineFormat = args['format'] == 'machine', |
| 178 perfReport = args['x-perf-report'], | 183 perfReport = args['x-perf-report'], |
| 179 shouldBatch = args['batch'], | 184 shouldBatch = args['batch'], |
| 180 showPackageWarnings = args['show-package-warnings'] || | 185 showPackageWarnings = args['show-package-warnings'] || |
| 181 args['package-warnings'] || | 186 args['package-warnings'] || |
| 182 args['x-package-warnings-prefix'] != null, | 187 args['x-package-warnings-prefix'] != null, |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 ..addFlag('log', | 466 ..addFlag('log', |
| 462 help: 'Log additional messages and exceptions.', | 467 help: 'Log additional messages and exceptions.', |
| 463 defaultsTo: false, | 468 defaultsTo: false, |
| 464 negatable: false, | 469 negatable: false, |
| 465 hide: hide) | 470 hide: hide) |
| 466 ..addFlag('enable_type_checks', | 471 ..addFlag('enable_type_checks', |
| 467 help: 'Check types in constant evaluation.', | 472 help: 'Check types in constant evaluation.', |
| 468 defaultsTo: false, | 473 defaultsTo: false, |
| 469 negatable: false, | 474 negatable: false, |
| 470 hide: hide) | 475 hide: hide) |
| 476 ..addFlag('enable-assert-initializers', |
| 477 help: 'Enable parsing of asserts in constructor initializers.', |
| 478 defaultsTo: false, |
| 479 negatable: false, |
| 480 hide: hide) |
| 471 ..addFlag('use-analysis-driver-memory-byte-store', | 481 ..addFlag('use-analysis-driver-memory-byte-store', |
| 472 help: 'Use memory byte store, not the file system cache.', | 482 help: 'Use memory byte store, not the file system cache.', |
| 473 defaultsTo: false, | 483 defaultsTo: false, |
| 474 negatable: false, | 484 negatable: false, |
| 475 hide: hide) | 485 hide: hide) |
| 476 ..addOption('url-mapping', | 486 ..addOption('url-mapping', |
| 477 help: '--url-mapping=libraryUri,/path/to/library.dart directs the ' | 487 help: '--url-mapping=libraryUri,/path/to/library.dart directs the ' |
| 478 'analyzer to use "library.dart" as the source for an import ' | 488 'analyzer to use "library.dart" as the source for an import ' |
| 479 'of "libraryUri".', | 489 'of "libraryUri".', |
| 480 allowMultiple: true, | 490 allowMultiple: true, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 'Usage: $_binaryName [options...] <directory or list of files>'); | 559 'Usage: $_binaryName [options...] <directory or list of files>'); |
| 550 errorSink.writeln(''); | 560 errorSink.writeln(''); |
| 551 errorSink.writeln(parser.usage); | 561 errorSink.writeln(parser.usage); |
| 552 errorSink.writeln(''); | 562 errorSink.writeln(''); |
| 553 errorSink.writeln(''' | 563 errorSink.writeln(''' |
| 554 Run "dartanalyzer -h -v" for verbose help output, including less commonly used o
ptions. | 564 Run "dartanalyzer -h -v" for verbose help output, including less commonly used o
ptions. |
| 555 For more information, see http://www.dartlang.org/tools/analyzer. | 565 For more information, see http://www.dartlang.org/tools/analyzer. |
| 556 '''); | 566 '''); |
| 557 } | 567 } |
| 558 } | 568 } |
| OLD | NEW |