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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart

Issue 599993004: Don't load transformers that aren't going to be used for an executable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
Index: sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart b/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart
index 1591046753bae989f27f3ba6f97266ec0955c298..6f2f09afedc86d10069a5e8a7016ace84fc66a74 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart
@@ -56,11 +56,16 @@ class AssetEnvironment {
/// If [packages] is passed, only those packages' assets will be loaded and
/// served.
///
+ /// If [entrypoints] is passed, only transformers necessary to run those
+ /// entrypoints will be loaded. Each entrypoint is expected to refer to a Dart
Bob Nystrom 2014/09/24 23:42:47 "will be" -> "are". It took me a while to break m
nweiz 2014/09/25 00:13:15 Done.
+ /// library.
+ ///
/// Returns a [Future] that completes to the environment once the inputs,
/// transformers, and server are loaded and ready.
static Future<AssetEnvironment> create(Entrypoint entrypoint,
BarbackMode mode, {WatcherType watcherType, String hostname, int basePort,
- Iterable<String> packages, bool useDart2JS: true}) {
+ Iterable<String> packages, Iterable<AssetId> entrypoints,
+ bool useDart2JS: true}) {
if (watcherType == null) watcherType = WatcherType.NONE;
if (hostname == null) hostname = "localhost";
if (basePort == null) basePort = 0;
@@ -74,7 +79,7 @@ class AssetEnvironment {
var environment = new AssetEnvironment._(graph, barback, mode,
watcherType, hostname, basePort);
- return environment._load(useDart2JS: useDart2JS)
+ return environment._load(entrypoints: entrypoints, useDart2JS: useDart2JS)
.then((_) => environment);
});
}
@@ -445,9 +450,12 @@ class AssetEnvironment {
/// If [useDart2JS] is `true`, then the [Dart2JSTransformer] is implicitly
/// added to end of the root package's transformer phases.
///
+ /// If [entrypoints] is passed, only transformers necessary to run those
+ /// entrypoints will be loaded.
+ ///
/// Returns a [Future] that completes once all inputs and transformers are
/// loaded.
- Future _load({bool useDart2JS}) {
+ Future _load({Iterable<AssetId> entrypoints, bool useDart2JS}) {
return log.progress("Initializing barback", () {
// If the entrypoint package manually configures the dart2js
// transformer, don't include it in the built-in transformer list.
@@ -504,7 +512,8 @@ class AssetEnvironment {
return _withStreamErrors(() {
return log.progress("Loading transformers", () {
- return loadAllTransformers(this, transformerServer)
+ return loadAllTransformers(this, transformerServer,
+ entrypoints: entrypoints)
.then((_) => transformerServer.close());
Bob Nystrom 2014/09/24 23:42:47 Whole lotta indentation here. How about using awai
nweiz 2014/09/25 00:13:15 Done.
}, fine: true);
}, [errorStream, barback.results, transformerServer.results]);

Powered by Google App Engine
This is Rietveld 408576698