| Index: sdk/lib/_internal/pub/lib/src/command/build.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/command/build.dart b/sdk/lib/_internal/pub/lib/src/command/build.dart
|
| index d7a6e8ee1556dbd64ed514d2f7e2b306aada7d0d..2513d8b990021a7a46c07b7cce8c75f2f7dad560 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command/build.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/command/build.dart
|
| @@ -62,7 +62,6 @@ class BuildCommand extends PubCommand {
|
| _parseBuildDirectories();
|
| cleanDir(target);
|
|
|
| - var environment;
|
| var errorsJson = [];
|
| var logJson = [];
|
|
|
| @@ -71,24 +70,15 @@ class BuildCommand extends PubCommand {
|
| // OS X buildbots.
|
| return BuildEnvironment.create(entrypoint, "127.0.0.1", 0, mode,
|
| WatcherType.NONE, useDart2JS: true)
|
| - .then((env) {
|
| - environment = env;
|
| -
|
| - // Register all of the build directories.
|
| - // TODO(rnystrom): We don't actually need to bind servers for these, we
|
| - // just need to add them to barback's sources. Add support to
|
| - // BuildEnvironment for going the latter without the former.
|
| - return Future.wait(buildDirectories.map(
|
| - (dir) => environment.serveDirectory(dir)));
|
| - }).then((_) {
|
| - // Show in-progress errors, but not results. Those get handled implicitly
|
| - // by getAllAssets().
|
| + .then((environment) {
|
| + // Show in-progress errors, but not results. Those get handled
|
| + // implicitly by getAllAssets().
|
| environment.barback.errors.listen((error) {
|
| log.error(log.red("Build error:\n$error"));
|
|
|
| if (log.json.enabled) {
|
| - // Wrap the error in a map in case we end up decorating it with more
|
| - // properties later.
|
| + // Wrap the error in a map in case we end up decorating it with
|
| + // more properties later.
|
| errorsJson.add({
|
| "error": error.toString()
|
| });
|
| @@ -102,8 +92,17 @@ class BuildCommand extends PubCommand {
|
| (entry) => logJson.add(_logEntryToJson(entry)));
|
| }
|
|
|
| - return log.progress("Building ${entrypoint.root.name}",
|
| - () => environment.barback.getAllAssets()).then((assets) {
|
| + return log.progress("Building ${entrypoint.root.name}", () {
|
| + // Register all of the build directories.
|
| + // TODO(rnystrom): We don't actually need to bind servers for these, we
|
| + // just need to add them to barback's sources. Add support to
|
| + // BuildEnvironment for going the latter without the former.
|
| + return Future.wait(buildDirectories.map(
|
| + (dir) => environment.serveDirectory(dir))).then((_) {
|
| +
|
| + return environment.barback.getAllAssets();
|
| + });
|
| + }).then((assets) {
|
| // Find all of the JS entrypoints we built.
|
| var dart2JSEntrypoints = assets
|
| .where((asset) => asset.id.path.endsWith(".dart.js"))
|
|
|