Index: sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart b/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
index 99b3919556d7d4a30415c24eaa59a2063c2f5447..82fa93418c8f46a3f26d0cc88855d57260fc84e7 100644 |
--- a/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
+++ b/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
@@ -228,12 +228,24 @@ class BuildEnvironment { |
]); |
} |
+ // "$pub" is a psuedo-package that allows pub's transformer-loading |
+ // infrastructure to share code with pub proper. We provide it only during |
+ // the initial transformer loading process. |
+ var dartPath = assetPath('dart'); |
+ var pubSources = listDir(dartPath).map((library) { |
+ return new AssetId('\$pub', |
+ path.join('lib', path.relative(library, from: dartPath))); |
+ }); |
+ |
// Bind a server that we can use to load the transformers. |
var transformerServer; |
return BarbackServer.bind(this, _hostname, 0, null).then((server) { |
transformerServer = server; |
- return log.progress("Loading source assets", _provideSources); |
+ return log.progress("Loading source assets", () { |
+ barback.updateSources(pubSources); |
+ return _provideSources(); |
+ }); |
}).then((_) { |
log.fine("Provided sources."); |
var completer = new Completer(); |
@@ -282,7 +294,7 @@ class BuildEnvironment { |
subscription.cancel(); |
} |
}); |
- }); |
+ }).then((_) => barback.removeSources(pubSources)); |
} |
/// Provides all of the source assets in the environment to barback. |