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; |
| 37 |
36 /// The path to output analysis results when in build mode. | 38 /// The path to output analysis results when in build mode. |
37 final String buildAnalysisOutput; | 39 final String buildAnalysisOutput; |
38 | 40 |
39 /// Whether to use build mode. | 41 /// Whether to use build mode. |
40 final bool buildMode; | 42 final bool buildMode; |
41 | 43 |
42 /// Whether to use build mode as a Bazel persistent worker. | 44 /// Whether to use build mode as a Bazel persistent worker. |
43 final bool buildModePersistentWorker; | 45 final bool buildModePersistentWorker; |
44 | 46 |
45 /// List of summary file paths to use in build mode. | 47 /// List of summary file paths to use in build mode. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 193 |
192 /// Whether to strictly follow the specification when generating warnings on | 194 /// Whether to strictly follow the specification when generating warnings on |
193 /// "call" methods (fixes dartbug.com/21938). | 195 /// "call" methods (fixes dartbug.com/21938). |
194 bool get enableStrictCallChecks => | 196 bool get enableStrictCallChecks => |
195 contextBuilderOptions.defaultOptions.enableStrictCallChecks; | 197 contextBuilderOptions.defaultOptions.enableStrictCallChecks; |
196 | 198 |
197 /// Whether to relax restrictions on mixins (DEP 34). | 199 /// Whether to relax restrictions on mixins (DEP 34). |
198 bool get enableSuperMixins => | 200 bool get enableSuperMixins => |
199 contextBuilderOptions.defaultOptions.enableSuperMixins; | 201 contextBuilderOptions.defaultOptions.enableSuperMixins; |
200 | 202 |
| 203 /// The path to a `.packages` configuration file |
| 204 String get packageConfigPath => contextBuilderOptions.defaultPackageFilePath; |
| 205 |
201 /// The path to the package root | 206 /// The path to the package root |
202 String get packageRootPath => | 207 String get packageRootPath => |
203 contextBuilderOptions.defaultPackagesDirectoryPath; | 208 contextBuilderOptions.defaultPackagesDirectoryPath; |
204 | 209 |
205 /// The path to a `.packages` configuration file | |
206 String get packageConfigPath => contextBuilderOptions.defaultPackageFilePath; | |
207 | |
208 /// Parse [args] into [CommandLineOptions] describing the specified | 210 /// Parse [args] into [CommandLineOptions] describing the specified |
209 /// analyzer options. In case of a format error, calls [printAndFail], which | 211 /// analyzer options. In case of a format error, calls [printAndFail], which |
210 /// by default prints an error message to stderr and exits. | 212 /// by default prints an error message to stderr and exits. |
211 static CommandLineOptions parse(List<String> args, | 213 static CommandLineOptions parse(List<String> args, |
212 [printAndFail(String msg) = printAndFail]) { | 214 [printAndFail(String msg) = printAndFail]) { |
213 CommandLineOptions options = _parse(args); | 215 CommandLineOptions options = _parse(args); |
214 // Check SDK. | 216 // Check SDK. |
215 if (!options.buildModePersistentWorker) { | 217 if (!options.buildModePersistentWorker) { |
216 // Infer if unspecified. | 218 // Infer if unspecified. |
217 if (options.dartSdkPath == null) { | 219 if (options.dartSdkPath == null) { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 529 |
528 static _showUsage(parser) { | 530 static _showUsage(parser) { |
529 errorSink | 531 errorSink |
530 .writeln('Usage: $_binaryName [options...] <libraries to analyze...>'); | 532 .writeln('Usage: $_binaryName [options...] <libraries to analyze...>'); |
531 errorSink.writeln(parser.getUsage()); | 533 errorSink.writeln(parser.getUsage()); |
532 errorSink.writeln(''); | 534 errorSink.writeln(''); |
533 errorSink.writeln( | 535 errorSink.writeln( |
534 'For more information, see http://www.dartlang.org/tools/analyzer.'); | 536 'For more information, see http://www.dartlang.org/tools/analyzer.'); |
535 } | 537 } |
536 } | 538 } |
OLD | NEW |