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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/serve.dart

Issue 1106713003: Support defining environment constants for dart2js via the command-line. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 8 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 | « sdk/lib/_internal/pub/lib/src/command/build.dart ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/command/serve.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/serve.dart b/sdk/lib/_internal/pub/lib/src/command/serve.dart
index 32074fc90fbd20bb3479b8148d5a21c5cd091b42..c5b47469379f7a510c2f5288c34d6e165c6ae0c5 100644
--- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
@@ -59,6 +59,9 @@ class ServeCommand extends BarbackCommand {
final _completer = new Completer();
ServeCommand() {
+ argParser.addOption("define", abbr: "D",
+ help: "Defines an environment constant for dart2js.",
+ allowMultiple: true, splitCommas: false);
argParser.addOption('hostname', defaultsTo: 'localhost',
help: 'The hostname to listen on.');
argParser.addOption('port', defaultsTo: '8080',
@@ -88,9 +91,13 @@ class ServeCommand extends BarbackCommand {
var watcherType = argResults['force-poll'] ?
WatcherType.POLLING : WatcherType.AUTO;
+ var environmentConstants = new Map.fromIterable(argResults["define"],
+ key: (pair) => pair.split("=").first,
+ value: (pair) => pair.split("=").last);
+
var environment = await AssetEnvironment.create(entrypoint, mode,
watcherType: watcherType, hostname: hostname, basePort: port,
- useDart2JS: useDart2JS);
+ useDart2JS: useDart2JS, environmentConstants: environmentConstants);
var directoryLength = sourceDirectories.map((dir) => dir.length)
.reduce(math.max);
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/build.dart ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698