| Index: sdk/lib/_internal/compiler/implementation/dart2js.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/dart2js.dart (revision 29517)
|
| +++ sdk/lib/_internal/compiler/implementation/dart2js.dart (working copy)
|
| @@ -112,6 +112,7 @@
|
| // TODO(johnniwinther): Measure time for reading files.
|
| SourceFileProvider inputProvider = new CompilerSourceFileProvider();
|
| diagnosticHandler = new FormattingDiagnosticHandler(inputProvider);
|
| + Map<String, dynamic> environment = new Map<String, dynamic>();
|
|
|
| passThrough(String argument) => options.add(argument);
|
|
|
| @@ -174,6 +175,13 @@
|
| passThrough('--verbose');
|
| }
|
|
|
| + addInEnvironment(String argument) {
|
| + int eqIndex = argument.indexOf('=');
|
| + String name = argument.substring(2, eqIndex);
|
| + String value = argument.substring(eqIndex + 1);
|
| + environment[name] = value;
|
| + }
|
| +
|
| setCategories(String argument) {
|
| List<String> categories = extractParameter(argument).split(',');
|
| Set<String> allowedCategories =
|
| @@ -275,6 +283,7 @@
|
| new OptionHandler('--terse', passThrough),
|
| new OptionHandler('--disallow-unsafe-eval',
|
| (_) => hasDisallowUnsafeEval = true),
|
| + new OptionHandler('-D.+=.+', addInEnvironment),
|
|
|
| // The following two options must come last.
|
| new OptionHandler('-.*', (String argument) {
|
| @@ -411,7 +420,7 @@
|
|
|
| return api.compile(uri, libraryRoot, packageRoot,
|
| inputProvider, diagnosticHandler,
|
| - options, outputProvider)
|
| + options, outputProvider, environment)
|
| .then(compilationDone);
|
| }
|
|
|
| @@ -494,6 +503,9 @@
|
| -v, --verbose
|
| Display verbose information.
|
|
|
| + -D<name>=<value>
|
| + Define an environment variable.
|
| +
|
| --version
|
| Display version information.
|
|
|
|
|