Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: lib/src/options.dart

Issue 1375643003: Remove outmoded --url-mapping option. (Closed) Base URL: https://github.com/dart-lang/analyzer_cli.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/driver.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/options.dart
diff --git a/lib/src/options.dart b/lib/src/options.dart
index 2106c0d3c4369e5b9b1c12e40bdebf854953dac8..499cbb643e05f88ba4a3b1caa0607112d9ae7f10 100644
--- a/lib/src/options.dart
+++ b/lib/src/options.dart
@@ -19,7 +19,6 @@ void printAndFail(String message, {int exitCode: 15}) {
/// Analyzer commandline configuration options.
class CommandLineOptions {
-
/// The path to an analysis options file
final String analysisOptionsFile;
@@ -82,10 +81,6 @@ class CommandLineOptions {
/// Whether to treat warnings as fatal
final bool warningsAreFatal;
- /// A table mapping library URIs to the file system path where the library
- /// source is located.
- final Map<String, String> customUrlMappings;
-
/// Whether to use package:dev_compiler for strong static checking.
final bool strongMode;
@@ -93,9 +88,8 @@ class CommandLineOptions {
final bool strongHints;
/// Initialize options from the given parsed [args].
- CommandLineOptions._fromArgs(ArgResults args,
- Map<String, String> definedVariables,
- Map<String, String> customUrlMappings)
+ CommandLineOptions._fromArgs(
+ ArgResults args, Map<String, String> definedVariables)
: dartSdkPath = args['dart-sdk'],
this.definedVariables = definedVariables,
analysisOptionsFile = args['options'],
@@ -112,12 +106,11 @@ class CommandLineOptions {
packageConfigPath = args['packages'],
packageRootPath = args['package-root'],
shouldBatch = args['batch'],
- showPackageWarnings = args['show-package-warnings'] ||
- args['package-warnings'],
+ showPackageWarnings =
+ args['show-package-warnings'] || args['package-warnings'],
showSdkWarnings = args['show-sdk-warnings'] || args['warnings'],
sourceFiles = args.rest,
warningsAreFatal = args['fatal-warnings'],
- this.customUrlMappings = customUrlMappings,
strongMode = args['strong'],
strongHints = args['strong-hints'];
@@ -189,10 +182,12 @@ class CommandLineOptions {
negatable: false)
..addOption('dart-sdk', help: 'The path to the Dart SDK.')
..addOption('packages',
- help: 'Path to the package resolution configuration file, which supplies a mapping of package names to paths. This option cannot be used with --package-root.')
+ help:
+ 'Path to the package resolution configuration file, which supplies a mapping of package names to paths. This option cannot be used with --package-root.')
..addOption('package-root',
abbr: 'p',
- help: 'Path to a package root directory (deprecated). This option cannot be used with --packages.')
+ help:
+ 'Path to a package root directory (deprecated). This option cannot be used with --packages.')
..addOption('options', help: 'Path to an analysis options file.')
..addOption('format',
help: 'Specifies the format in which errors are displayed.')
@@ -241,7 +236,8 @@ class CommandLineOptions {
negatable: false)
..addOption('url-mapping',
help: '--url-mapping=libraryUri,/path/to/library.dart directs the '
- 'analyzer to use "library.dart" as the source for an import ' 'of "libraryUri".',
+ 'analyzer to use "library.dart" as the source for an import '
+ 'of "libraryUri".',
allowMultiple: true,
splitCommas: false)
//
@@ -314,17 +310,7 @@ class CommandLineOptions {
exit(15);
}
}
- Map<String, String> customUrlMappings = <String, String>{};
- for (String mapping in results['url-mapping']) {
- List<String> splitMapping = mapping.split(',');
- if (splitMapping.length != 2) {
- _showUsage(parser);
- exit(15);
- }
- customUrlMappings[splitMapping[0]] = splitMapping[1];
- }
- return new CommandLineOptions._fromArgs(
- results, definedVariables, customUrlMappings);
+ return new CommandLineOptions._fromArgs(results, definedVariables);
} on FormatException catch (e) {
print(e.message);
_showUsage(parser);
@@ -360,8 +346,13 @@ class CommandLineParser {
/// Defines a flag.
/// See [ArgParser.addFlag()].
- void addFlag(String name, {String abbr, String help, bool defaultsTo: false,
- bool negatable: true, void callback(bool value), bool hide: false}) {
+ void addFlag(String name,
+ {String abbr,
+ String help,
+ bool defaultsTo: false,
+ bool negatable: true,
+ void callback(bool value),
+ bool hide: false}) {
_knownFlags.add(name);
_parser.addFlag(name,
abbr: abbr,
@@ -374,9 +365,15 @@ class CommandLineParser {
/// Defines a value-taking option.
/// See [ArgParser.addOption()].
- void addOption(String name, {String abbr, String help, List<String> allowed,
- Map<String, String> allowedHelp, String defaultsTo, void callback(value),
- bool allowMultiple: false, bool splitCommas}) {
+ void addOption(String name,
+ {String abbr,
+ String help,
+ List<String> allowed,
+ Map<String, String> allowedHelp,
+ String defaultsTo,
+ void callback(value),
+ bool allowMultiple: false,
+ bool splitCommas}) {
_knownFlags.add(name);
_parser.addOption(name,
abbr: abbr,
@@ -397,9 +394,9 @@ class CommandLineParser {
/// flags and options defined by this parser, and returns the result. The
/// values of any defined variables are captured in the given map.
/// See [ArgParser].
- ArgResults parse(
- List<String> args, Map<String, String> definedVariables) => _parser
- .parse(_filterUnknowns(parseDefinedVariables(args, definedVariables)));
+ ArgResults parse(List<String> args, Map<String, String> definedVariables) =>
+ _parser.parse(
+ _filterUnknowns(parseDefinedVariables(args, definedVariables)));
List<String> parseDefinedVariables(
List<String> args, Map<String, String> definedVariables) {
@@ -421,12 +418,10 @@ class CommandLineParser {
}
List<String> _filterUnknowns(List<String> args) {
-
// Only filter args if the ignore flag is specified, or if
// _alwaysIgnoreUnrecognized was set to true.
if (_alwaysIgnoreUnrecognized ||
args.contains('--ignore-unrecognized-flags')) {
-
//TODO(pquitslund): replace w/ the following once library skew issues are
// sorted out
//return args.where((arg) => !arg.startsWith('--') ||
« no previous file with comments | « lib/src/driver.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698