| 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:analyzer/file_system/physical_file_system.dart'; | 7 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 8 import 'package:analyzer/src/command_line/arguments.dart'; | 8 import 'package:analyzer/src/command_line/arguments.dart'; |
| 9 import 'package:analyzer/src/context/builder.dart'; | 9 import 'package:analyzer/src/context/builder.dart'; |
| 10 import 'package:analyzer/src/util/sdk.dart'; | 10 import 'package:analyzer/src/util/sdk.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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 = true; | 36 final bool enableNewAnalysisDriver = true; |
| 37 | 37 |
| 38 /// Return `true` if the parser is to parse asserts in the initializer list of | 38 /// Return `true` if the parser is to parse asserts in the initializer list of |
| 39 /// a constructor. | 39 /// a constructor. |
| 40 final bool enableAssertInitializer; | 40 final bool enableAssertInitializer; |
| 41 | 41 |
| 42 /// Whether declaration casts are enabled (in strong mode) |
| 43 final bool declarationCasts; |
| 44 |
| 42 /// The path to output analysis results when in build mode. | 45 /// The path to output analysis results when in build mode. |
| 43 final String buildAnalysisOutput; | 46 final String buildAnalysisOutput; |
| 44 | 47 |
| 45 /// Whether to use build mode. | 48 /// Whether to use build mode. |
| 46 final bool buildMode; | 49 final bool buildMode; |
| 47 | 50 |
| 48 /// Whether to use build mode as a Bazel persistent worker. | 51 /// Whether to use build mode as a Bazel persistent worker. |
| 49 final bool buildModePersistentWorker; | 52 final bool buildModePersistentWorker; |
| 50 | 53 |
| 51 /// List of summary file paths to use in build mode. | 54 /// List of summary file paths to use in build mode. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 buildSummaryUnlinkedInputs = | 166 buildSummaryUnlinkedInputs = |
| 164 args['build-summary-unlinked-input'] as List<String>, | 167 args['build-summary-unlinked-input'] as List<String>, |
| 165 buildSummaryOnly = args['build-summary-only'], | 168 buildSummaryOnly = args['build-summary-only'], |
| 166 buildSummaryOnlyUnlinked = args['build-summary-only-unlinked'], | 169 buildSummaryOnlyUnlinked = args['build-summary-only-unlinked'], |
| 167 buildSummaryOutput = args['build-summary-output'], | 170 buildSummaryOutput = args['build-summary-output'], |
| 168 buildSummaryOutputSemantic = args['build-summary-output-semantic'], | 171 buildSummaryOutputSemantic = args['build-summary-output-semantic'], |
| 169 buildSuppressExitCode = args['build-suppress-exit-code'], | 172 buildSuppressExitCode = args['build-suppress-exit-code'], |
| 170 contextBuilderOptions = createContextBuilderOptions(args), | 173 contextBuilderOptions = createContextBuilderOptions(args), |
| 171 dartSdkPath = args['dart-sdk'], | 174 dartSdkPath = args['dart-sdk'], |
| 172 dartSdkSummaryPath = args['dart-sdk-summary'], | 175 dartSdkSummaryPath = args['dart-sdk-summary'], |
| 176 declarationCasts = args.wasParsed(declarationCastsFlag) |
| 177 ? args[declarationCastsFlag] |
| 178 : args[implicitCastsFlag], |
| 173 disableCacheFlushing = args['disable-cache-flushing'], | 179 disableCacheFlushing = args['disable-cache-flushing'], |
| 174 disableHints = args['no-hints'], | 180 disableHints = args['no-hints'], |
| 175 displayVersion = args['version'], | 181 displayVersion = args['version'], |
| 176 enableTypeChecks = args['enable_type_checks'], | 182 enableTypeChecks = args['enable_type_checks'], |
| 177 enableAssertInitializer = args['enable-assert-initializers'], | 183 enableAssertInitializer = args['enable-assert-initializers'], |
| 178 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 184 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
| 179 lints = args[lintsFlag], | 185 lints = args[lintsFlag], |
| 180 log = args['log'], | 186 log = args['log'], |
| 181 machineFormat = args['format'] == 'machine', | 187 machineFormat = args['format'] == 'machine', |
| 182 perfReport = args['x-perf-report'], | 188 perfReport = args['x-perf-report'], |
| 183 batchMode = args['batch'], | 189 batchMode = args['batch'], |
| 184 showPackageWarnings = args['show-package-warnings'] || | 190 showPackageWarnings = args['show-package-warnings'] || |
| 185 args['package-warnings'] || | 191 args['package-warnings'] || |
| 186 args['x-package-warnings-prefix'] != null, | 192 args['x-package-warnings-prefix'] != null, |
| 187 showPackageWarningsPrefix = args['x-package-warnings-prefix'], | 193 showPackageWarningsPrefix = args['x-package-warnings-prefix'], |
| 188 showSdkWarnings = args['sdk-warnings'], | 194 showSdkWarnings = args['sdk-warnings'], |
| 189 _sourceFiles = args.rest, | 195 _sourceFiles = args.rest, |
| 190 infosAreFatal = args['fatal-infos'] || args['fatal-hints'], | 196 infosAreFatal = args['fatal-infos'] || args['fatal-hints'], |
| 191 warningsAreFatal = args['fatal-warnings'], | 197 warningsAreFatal = args['fatal-warnings'], |
| 192 lintsAreFatal = args['fatal-lints'], | 198 lintsAreFatal = args['fatal-lints'], |
| 193 strongMode = args['strong'], | 199 strongMode = args['strong'], |
| 194 implicitCasts = !args['no-implicit-casts'], | 200 implicitCasts = args[implicitCastsFlag], |
| 195 implicitDynamic = !args['no-implicit-dynamic'], | 201 implicitDynamic = !args['no-implicit-dynamic'], |
| 196 useAnalysisDriverMemoryByteStore = | 202 useAnalysisDriverMemoryByteStore = |
| 197 args['use-analysis-driver-memory-byte-store'], | 203 args['use-analysis-driver-memory-byte-store'], |
| 198 verbose = args['verbose'], | 204 verbose = args['verbose'], |
| 199 color = args['color']; | 205 color = args['color']; |
| 200 | 206 |
| 201 /// The path to an analysis options file | 207 /// The path to an analysis options file |
| 202 String get analysisOptionsFile => | 208 String get analysisOptionsFile => |
| 203 contextBuilderOptions.defaultAnalysisOptionsFilePath; | 209 contextBuilderOptions.defaultAnalysisOptionsFilePath; |
| 204 | 210 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 if (analytics != null && !analytics.firstRun) { | 608 if (analytics != null && !analytics.firstRun) { |
| 603 printAnalyticsInfo(); | 609 printAnalyticsInfo(); |
| 604 } | 610 } |
| 605 | 611 |
| 606 errorSink.writeln(''); | 612 errorSink.writeln(''); |
| 607 errorSink.writeln(''' | 613 errorSink.writeln(''' |
| 608 Run "dartanalyzer -h -v" for verbose help output, including less commonly used o
ptions. | 614 Run "dartanalyzer -h -v" for verbose help output, including less commonly used o
ptions. |
| 609 For more information, see https://www.dartlang.org/tools/analyzer.\n'''); | 615 For more information, see https://www.dartlang.org/tools/analyzer.\n'''); |
| 610 } | 616 } |
| 611 } | 617 } |
| OLD | NEW |