| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 /// List of summary file paths to use in build mode. | 51 /// List of summary file paths to use in build mode. |
| 52 final List<String> buildSummaryInputs; | 52 final List<String> buildSummaryInputs; |
| 53 | 53 |
| 54 /// List of unlinked summary file paths to use in build mode. | 54 /// List of unlinked summary file paths to use in build mode. |
| 55 final List<String> buildSummaryUnlinkedInputs; | 55 final List<String> buildSummaryUnlinkedInputs; |
| 56 | 56 |
| 57 /// Whether to skip analysis when creating summaries in build mode. | 57 /// Whether to skip analysis when creating summaries in build mode. |
| 58 final bool buildSummaryOnly; | 58 final bool buildSummaryOnly; |
| 59 | 59 |
| 60 /// Whether to use diet parsing, i.e. skip function bodies. We don't need to | |
| 61 /// analyze function bodies to use summaries during future compilation steps. | |
| 62 final bool buildSummaryOnlyDiet; | |
| 63 | |
| 64 /// Whether to only produce unlinked summaries instead of linked summaries. | 60 /// Whether to only produce unlinked summaries instead of linked summaries. |
| 65 /// Must be used in combination with `buildSummaryOnly`. | 61 /// Must be used in combination with `buildSummaryOnly`. |
| 66 final bool buildSummaryOnlyUnlinked; | 62 final bool buildSummaryOnlyUnlinked; |
| 67 | 63 |
| 68 /// The path to output the summary when creating summaries in build mode. | 64 /// The path to output the summary when creating summaries in build mode. |
| 69 final String buildSummaryOutput; | 65 final String buildSummaryOutput; |
| 70 | 66 |
| 71 /// The path to output the semantic-only summary when creating summaries in | 67 /// The path to output the semantic-only summary when creating summaries in |
| 72 /// build mode. | 68 /// build mode. |
| 73 final String buildSummaryOutputSemantic; | 69 final String buildSummaryOutputSemantic; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 156 |
| 161 /// Initialize options from the given parsed [args]. | 157 /// Initialize options from the given parsed [args]. |
| 162 CommandLineOptions._fromArgs(ArgResults args) | 158 CommandLineOptions._fromArgs(ArgResults args) |
| 163 : buildAnalysisOutput = args['build-analysis-output'], | 159 : buildAnalysisOutput = args['build-analysis-output'], |
| 164 buildMode = args['build-mode'], | 160 buildMode = args['build-mode'], |
| 165 buildModePersistentWorker = args['persistent_worker'], | 161 buildModePersistentWorker = args['persistent_worker'], |
| 166 buildSummaryInputs = args['build-summary-input'] as List<String>, | 162 buildSummaryInputs = args['build-summary-input'] as List<String>, |
| 167 buildSummaryUnlinkedInputs = | 163 buildSummaryUnlinkedInputs = |
| 168 args['build-summary-unlinked-input'] as List<String>, | 164 args['build-summary-unlinked-input'] as List<String>, |
| 169 buildSummaryOnly = args['build-summary-only'], | 165 buildSummaryOnly = args['build-summary-only'], |
| 170 buildSummaryOnlyDiet = args['build-summary-only-diet'], | |
| 171 buildSummaryOnlyUnlinked = args['build-summary-only-unlinked'], | 166 buildSummaryOnlyUnlinked = args['build-summary-only-unlinked'], |
| 172 buildSummaryOutput = args['build-summary-output'], | 167 buildSummaryOutput = args['build-summary-output'], |
| 173 buildSummaryOutputSemantic = args['build-summary-output-semantic'], | 168 buildSummaryOutputSemantic = args['build-summary-output-semantic'], |
| 174 buildSuppressExitCode = args['build-suppress-exit-code'], | 169 buildSuppressExitCode = args['build-suppress-exit-code'], |
| 175 contextBuilderOptions = createContextBuilderOptions(args), | 170 contextBuilderOptions = createContextBuilderOptions(args), |
| 176 dartSdkPath = args['dart-sdk'], | 171 dartSdkPath = args['dart-sdk'], |
| 177 dartSdkSummaryPath = args['dart-sdk-summary'], | 172 dartSdkSummaryPath = args['dart-sdk-summary'], |
| 178 disableCacheFlushing = args['disable-cache-flushing'], | 173 disableCacheFlushing = args['disable-cache-flushing'], |
| 179 disableHints = args['no-hints'], | 174 disableHints = args['no-hints'], |
| 180 displayVersion = args['version'], | 175 displayVersion = args['version'], |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return null; // Only reachable in testing. | 269 return null; // Only reachable in testing. |
| 275 } | 270 } |
| 276 } | 271 } |
| 277 | 272 |
| 278 // Build mode. | 273 // Build mode. |
| 279 if (options.buildModePersistentWorker && !options.buildMode) { | 274 if (options.buildModePersistentWorker && !options.buildMode) { |
| 280 printAndFail('The option --persisten_worker can be used only ' | 275 printAndFail('The option --persisten_worker can be used only ' |
| 281 'together with --build-mode.'); | 276 'together with --build-mode.'); |
| 282 return null; // Only reachable in testing. | 277 return null; // Only reachable in testing. |
| 283 } | 278 } |
| 284 if (options.buildSummaryOnlyDiet && !options.buildSummaryOnly) { | |
| 285 printAndFail('The option --build-summary-only-diet can be used only ' | |
| 286 'together with --build-summary-only.'); | |
| 287 return null; // Only reachable in testing. | |
| 288 } | |
| 289 | 279 |
| 290 if (options.buildSummaryOnlyUnlinked) { | 280 if (options.buildSummaryOnlyUnlinked) { |
| 291 if (!options.buildSummaryOnly) { | 281 if (!options.buildSummaryOnly) { |
| 292 printAndFail( | 282 printAndFail( |
| 293 'The option --build-summary-only-unlinked can be used only ' | 283 'The option --build-summary-only-unlinked can be used only ' |
| 294 'together with --build-summary-only.'); | 284 'together with --build-summary-only.'); |
| 295 return null; // Only reachable in testing. | 285 return null; // Only reachable in testing. |
| 296 } | 286 } |
| 297 if (options.buildSummaryInputs.isNotEmpty || | 287 if (options.buildSummaryInputs.isNotEmpty || |
| 298 options.buildSummaryUnlinkedInputs.isNotEmpty) { | 288 options.buildSummaryUnlinkedInputs.isNotEmpty) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 hide: hide) | 394 hide: hide) |
| 405 ..addOption('build-summary-output-semantic', | 395 ..addOption('build-summary-output-semantic', |
| 406 help: 'Specifies the path to the file where the semantic summary ' | 396 help: 'Specifies the path to the file where the semantic summary ' |
| 407 'information should be written.', | 397 'information should be written.', |
| 408 hide: hide) | 398 hide: hide) |
| 409 ..addFlag('build-summary-only', | 399 ..addFlag('build-summary-only', |
| 410 help: 'Disable analysis (only generate summaries).', | 400 help: 'Disable analysis (only generate summaries).', |
| 411 defaultsTo: false, | 401 defaultsTo: false, |
| 412 negatable: false, | 402 negatable: false, |
| 413 hide: hide) | 403 hide: hide) |
| 414 ..addFlag('build-summary-only-diet', | |
| 415 help: 'Diet parse function bodies.', | |
| 416 defaultsTo: false, | |
| 417 negatable: false, | |
| 418 hide: hide) | |
| 419 ..addFlag('build-summary-only-unlinked', | 404 ..addFlag('build-summary-only-unlinked', |
| 420 help: 'Only output the unlinked summary.', | 405 help: 'Only output the unlinked summary.', |
| 421 defaultsTo: false, | 406 defaultsTo: false, |
| 422 negatable: false, | 407 negatable: false, |
| 423 hide: hide) | 408 hide: hide) |
| 424 ..addFlag('build-suppress-exit-code', | 409 ..addFlag('build-suppress-exit-code', |
| 425 help: 'Exit with code 0 even if errors are found.', | 410 help: 'Exit with code 0 even if errors are found.', |
| 426 defaultsTo: false, | 411 defaultsTo: false, |
| 427 negatable: false, | 412 negatable: false, |
| 428 hide: hide) | 413 hide: hide) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 if (analytics != null && !analytics.firstRun) { | 602 if (analytics != null && !analytics.firstRun) { |
| 618 printAnalyticsInfo(); | 603 printAnalyticsInfo(); |
| 619 } | 604 } |
| 620 | 605 |
| 621 errorSink.writeln(''); | 606 errorSink.writeln(''); |
| 622 errorSink.writeln(''' | 607 errorSink.writeln(''' |
| 623 Run "dartanalyzer -h -v" for verbose help output, including less commonly used o
ptions. | 608 Run "dartanalyzer -h -v" for verbose help output, including less commonly used o
ptions. |
| 624 For more information, see https://www.dartlang.org/tools/analyzer.\n'''); | 609 For more information, see https://www.dartlang.org/tools/analyzer.\n'''); |
| 625 } | 610 } |
| 626 } | 611 } |
| OLD | NEW |