Index: pkg/analyzer/lib/options.dart |
=================================================================== |
--- pkg/analyzer/lib/options.dart (revision 43472) |
+++ 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', |
Brian Wilkerson
2015/02/13 23:56:13
I know it's inconsistent with the python script, b
zra
2015/02/14 01:01:56
Done.
|
+ 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 (var mapping in results['url_mapping']) { |
Brian Wilkerson
2015/02/13 23:56:13
Everything in analyzer is fully type annotated.
zra
2015/02/14 01:01:56
Done.
|
+ var 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); |