| 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..d7e9de5f56f7724bc9cbedec5b36de47d0fa7bbb 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| @@ -10,7 +10,6 @@ import 'dart:math' as math;
|
| import 'package:barback/barback.dart';
|
|
|
| import '../barback/asset_environment.dart';
|
| -import '../barback/pub_package_provider.dart';
|
| import '../log.dart' as log;
|
| import '../utils.dart';
|
| import 'barback.dart';
|
| @@ -27,8 +26,6 @@ class ServeCommand extends BarbackCommand {
|
| String get invocation => "pub serve [directories...]";
|
| String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-serve.html";
|
|
|
| - PubPackageProvider _provider;
|
| -
|
| String get hostname => argResults['hostname'];
|
|
|
| /// The base port for the servers.
|
| @@ -59,6 +56,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 +88,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);
|
|
|
|
|