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

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') | pkg/analyzer/lib/src/generated/source.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | pkg/analyzer/lib/src/generated/source.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698