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

Side by Side Diff: pkg/barback/lib/src/package_graph.dart

Issue 149243009: Add support for lazy transformers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/lazy_transformer.dart ('k') | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library barback.package_graph; 5 library barback.package_graph;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'asset_cascade.dart'; 9 import 'asset_cascade.dart';
10 import 'asset_id.dart'; 10 import 'asset_id.dart';
11 import 'asset_node.dart'; 11 import 'asset_node.dart';
12 import 'asset_set.dart'; 12 import 'asset_set.dart';
13 import 'build_result.dart'; 13 import 'build_result.dart';
14 import 'errors.dart'; 14 import 'errors.dart';
15 import 'log.dart'; 15 import 'log.dart';
16 import 'package_provider.dart'; 16 import 'package_provider.dart';
17 import 'pool.dart';
18 import 'transformer.dart'; 17 import 'transformer.dart';
19 import 'utils.dart'; 18 import 'utils.dart';
20 19
21 /// The collection of [AssetCascade]s for an entire application. 20 /// The collection of [AssetCascade]s for an entire application.
22 /// 21 ///
23 /// This tracks each package's [AssetCascade] and routes asset requests between 22 /// This tracks each package's [AssetCascade] and routes asset requests between
24 /// them. 23 /// them.
25 class PackageGraph { 24 class PackageGraph {
26 /// The provider that exposes asset and package information. 25 /// The provider that exposes asset and package information.
27 final PackageProvider provider; 26 final PackageProvider provider;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 var cascade = _cascades[id.package]; 131 var cascade = _cascades[id.package];
133 if (cascade != null) return cascade.getAssetNode(id); 132 if (cascade != null) return cascade.getAssetNode(id);
134 return new Future.value(null); 133 return new Future.value(null);
135 } 134 }
136 135
137 /// Gets all output assets. 136 /// Gets all output assets.
138 /// 137 ///
139 /// If a build is currently in progress, waits until it completes. The 138 /// If a build is currently in progress, waits until it completes. The
140 /// returned future will complete with an error if the build is not 139 /// returned future will complete with an error if the build is not
141 /// successful. 140 /// successful.
141 ///
142 /// Any transforms using [LazyTransformer]s will be forced to generate
143 /// concrete outputs, and those outputs will be returned.
142 Future<AssetSet> getAllAssets() { 144 Future<AssetSet> getAllAssets() {
145 for (var cascade in _cascades.values) {
146 cascade.forceAllTransforms();
147 }
148
143 if (_cascadeResults.values.contains(null)) { 149 if (_cascadeResults.values.contains(null)) {
144 // A build is still ongoing, so wait for it to complete and try again. 150 // A build is still ongoing, so wait for it to complete and try again.
145 return results.first.then((_) => getAllAssets()); 151 return results.first.then((_) => getAllAssets());
146 } 152 }
147 153
148 // If an unexpected error occurred, complete with that. 154 // If an unexpected error occurred, complete with that.
149 if (_lastUnexpectedError != null) { 155 if (_lastUnexpectedError != null) {
150 var error = _lastUnexpectedError; 156 var error = _lastUnexpectedError;
151 _lastUnexpectedError = null; 157 _lastUnexpectedError = null;
152 return new Future.error(error, _lastUnexpectedErrorTrace); 158 return new Future.error(error, _lastUnexpectedErrorTrace);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (cascade == null) throw new ArgumentError("Unknown package $package."); 191 if (cascade == null) throw new ArgumentError("Unknown package $package.");
186 cascade.removeSources(ids); 192 cascade.removeSources(ids);
187 }); 193 });
188 } 194 }
189 195
190 void updateTransformers(String package, 196 void updateTransformers(String package,
191 Iterable<Iterable<Transformer>> transformers) { 197 Iterable<Iterable<Transformer>> transformers) {
192 _cascades[package].updateTransformers(transformers); 198 _cascades[package].updateTransformers(transformers);
193 } 199 }
194 } 200 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/lazy_transformer.dart ('k') | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698