| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.command_line.arguments; | 5 library analyzer.src.command_line.arguments; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/src/context/builder.dart'; | 10 import 'package:analyzer/src/context/builder.dart'; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * Add the standard flags and options to the given [parser]. The standard flags | 128 * Add the standard flags and options to the given [parser]. The standard flags |
| 129 * are those that are typically used to control the way in which the code is | 129 * are those that are typically used to control the way in which the code is |
| 130 * analyzed. | 130 * analyzed. |
| 131 * | 131 * |
| 132 * TODO(danrubel) Update DDC to support all the options defined in this method | 132 * TODO(danrubel) Update DDC to support all the options defined in this method |
| 133 * then remove the [ddc] named argument from this method. | 133 * then remove the [ddc] named argument from this method. |
| 134 */ | 134 */ |
| 135 void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) { | 135 void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) { |
| 136 parser.addOption(sdkPathOption, help: 'The path to the Dart SDK.'); |
| 137 parser.addOption(analysisOptionsFileOption, |
| 138 help: 'Path to an analysis options file.'); |
| 139 parser.addOption(packageRootOption, |
| 140 help: 'The path to a package root directory (deprecated). ' |
| 141 'This option cannot be used with --packages.'); |
| 142 parser.addFlag(strongModeFlag, |
| 143 help: 'Enable strong static checks (https://goo.gl/DqcBsw).', |
| 144 defaultsTo: ddc); |
| 145 parser.addFlag(noImplicitCastsFlag, |
| 146 negatable: false, |
| 147 help: 'Disable implicit casts in strong mode (https://goo.gl/cTLz40).'); |
| 148 parser.addFlag(noImplicitDynamicFlag, |
| 149 negatable: false, |
| 150 help: 'Disable implicit dynamic (https://goo.gl/m0UgXD).'); |
| 151 |
| 152 // |
| 153 // Hidden flags and options. |
| 154 // |
| 136 parser.addOption(defineVariableOption, | 155 parser.addOption(defineVariableOption, |
| 137 abbr: 'D', | 156 abbr: 'D', |
| 138 allowMultiple: true, | 157 allowMultiple: true, |
| 139 help: 'Define environment variables. For example, "-Dfoo=bar" defines an ' | 158 help: 'Define environment variables. For example, "-Dfoo=bar" defines an ' |
| 140 'environment variable named "foo" whose value is "bar".'); | 159 'environment variable named "foo" whose value is "bar".', |
| 141 | 160 hide: hide); |
| 142 parser.addOption(sdkPathOption, help: 'The path to the Dart SDK.'); | |
| 143 parser.addOption(sdkSummaryPathOption, | |
| 144 help: 'The path to the Dart SDK summary file.', hide: hide); | |
| 145 | |
| 146 parser.addOption(analysisOptionsFileOption, | |
| 147 help: 'Path to an analysis options file.'); | |
| 148 | |
| 149 parser.addOption(packageRootOption, | |
| 150 abbr: 'p', | |
| 151 help: 'The path to a package root directory (deprecated). ' | |
| 152 'This option cannot be used with --packages.'); | |
| 153 parser.addOption(packagesOption, | 161 parser.addOption(packagesOption, |
| 154 help: 'The path to the package resolution configuration file, which ' | 162 help: 'The path to the package resolution configuration file, which ' |
| 155 'supplies a mapping of package names to paths. This option cannot be ' | 163 'supplies a mapping of package names to paths. This option cannot be ' |
| 156 'used with --package-root.', | 164 'used with --package-root.', |
| 157 hide: ddc); | 165 hide: ddc); |
| 158 | 166 parser.addOption(sdkSummaryPathOption, |
| 159 parser.addFlag(strongModeFlag, | 167 help: 'The path to the Dart SDK summary file.', hide: hide); |
| 160 help: 'Enable strong static checks (https://goo.gl/DqcBsw)', | |
| 161 defaultsTo: ddc); | |
| 162 parser.addFlag(noImplicitCastsFlag, | |
| 163 negatable: false, | |
| 164 help: 'Disable implicit casts in strong mode (https://goo.gl/cTLz40)'); | |
| 165 parser.addFlag(noImplicitDynamicFlag, | |
| 166 negatable: false, | |
| 167 help: 'Disable implicit dynamic (https://goo.gl/m0UgXD)'); | |
| 168 // | |
| 169 // Hidden flags and options. | |
| 170 // | |
| 171 // parser.addFlag(enableNullAwareOperatorsFlag, // 'enable-null-aware-operators
' | 168 // parser.addFlag(enableNullAwareOperatorsFlag, // 'enable-null-aware-operators
' |
| 172 // help: 'Enable support for null-aware operators (DEP 9).', | 169 // help: 'Enable support for null-aware operators (DEP 9).', |
| 173 // defaultsTo: false, | 170 // defaultsTo: false, |
| 174 // negatable: false, | 171 // negatable: false, |
| 175 // hide: hide || ddc); | 172 // hide: hide || ddc); |
| 176 parser.addFlag(enableStrictCallChecksFlag, | 173 parser.addFlag(enableStrictCallChecksFlag, |
| 177 help: 'Fix issue 21938.', | 174 help: 'Fix issue 21938.', |
| 178 defaultsTo: false, | 175 defaultsTo: false, |
| 179 negatable: false, | 176 negatable: false, |
| 180 hide: hide); | 177 hide: hide); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 .replaceAll('\r\n', '\n') | 312 .replaceAll('\r\n', '\n') |
| 316 .replaceAll('\r', '\n') | 313 .replaceAll('\r', '\n') |
| 317 .split('\n') | 314 .split('\n') |
| 318 .where((String line) => line.isNotEmpty)); | 315 .where((String line) => line.isNotEmpty)); |
| 319 } on FileSystemException catch (e) { | 316 } on FileSystemException catch (e) { |
| 320 throw new Exception('Failed to read file specified by $lastArg : $e'); | 317 throw new Exception('Failed to read file specified by $lastArg : $e'); |
| 321 } | 318 } |
| 322 } | 319 } |
| 323 return args; | 320 return args; |
| 324 } | 321 } |
| OLD | NEW |