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

Unified Diff: pkg/analyzer/lib/options.dart

Issue 897593005: Adds a repeatable --url_mapping flag to dartanalyzer (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 | « no previous file | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/options.dart
===================================================================
--- pkg/analyzer/lib/options.dart (revision 43787)
+++ pkg/analyzer/lib/options.dart (working copy)
@@ -65,11 +65,16 @@
/** 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;
+
/**
* Initialize options from the given parsed [args].
*/
CommandLineOptions._fromArgs(ArgResults args, Map<String,
- String> definedVariables)
+ String> definedVariables, Map<String, String> customUrlMappings)
: dartSdkPath = args['dart-sdk'],
this.definedVariables = definedVariables,
disableHints = args['no-hints'],
@@ -86,7 +91,8 @@
showSdkWarnings = args['show-sdk-warnings'] || args['warnings'],
sourceFiles = args.rest,
warmPerf = args['warm-perf'],
- warningsAreFatal = args['fatal-warnings'];
+ warningsAreFatal = args['fatal-warnings'],
+ this.customUrlMappings = customUrlMappings;
/**
* Parse [args] into [CommandLineOptions] describing the specified
@@ -199,6 +205,12 @@
help: 'Display this help message',
defaultsTo: false,
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"',
+ allowMultiple: true)
//
// Hidden flags.
//
@@ -260,7 +272,17 @@
exit(15);
}
}
- return new CommandLineOptions._fromArgs(results, definedVariables);
+ 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);
} on FormatException catch (e) {
print(e.message);
_showUsage(parser);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698