| OLD | NEW |
| 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.phase_input; | 5 library barback.phase_input; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'asset.dart'; | 10 import 'asset.dart'; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 _newPassThrough = true; | 139 _newPassThrough = true; |
| 140 } | 140 } |
| 141 | 141 |
| 142 var brandNewTransformers = newTransformers.difference(oldTransformers); | 142 var brandNewTransformers = newTransformers.difference(oldTransformers); |
| 143 if (brandNewTransformers.isEmpty) return; | 143 if (brandNewTransformers.isEmpty) return; |
| 144 | 144 |
| 145 brandNewTransformers.forEach(_transformers.add); | 145 brandNewTransformers.forEach(_transformers.add); |
| 146 if (_adjustTransformersFuture == null) _adjustTransformers(); | 146 if (_adjustTransformersFuture == null) _adjustTransformers(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 /// Force all [LazyTransformer]s' transforms in this input to begin producing |
| 150 /// concrete assets. |
| 151 void forceAllTransforms() { |
| 152 for (var transform in _transforms) { |
| 153 transform.force(); |
| 154 } |
| 155 } |
| 156 |
| 149 /// Asynchronously determines which transformers can consume [input] as a | 157 /// Asynchronously determines which transformers can consume [input] as a |
| 150 /// primary input and creates transforms for them. | 158 /// primary input and creates transforms for them. |
| 151 /// | 159 /// |
| 152 /// This ensures that if [input] is modified or removed during or after the | 160 /// This ensures that if [input] is modified or removed during or after the |
| 153 /// time it takes to adjust its transformers, they're appropriately | 161 /// time it takes to adjust its transformers, they're appropriately |
| 154 /// re-adjusted. Its progress can be tracked in [_adjustTransformersFuture]. | 162 /// re-adjusted. Its progress can be tracked in [_adjustTransformersFuture]. |
| 155 void _adjustTransformers() { | 163 void _adjustTransformers() { |
| 156 // Mark the input as dirty. This may not actually end up creating any new | 164 // Mark the input as dirty. This may not actually end up creating any new |
| 157 // transforms, but we want adding or removing a source asset to consistently | 165 // transforms, but we want adding or removing a source asset to consistently |
| 158 // kick off a build, even if that build does nothing. | 166 // kick off a build, even if that build does nothing. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return new Future.value( | 314 return new Future.value( |
| 307 new Set<AssetNode>.from([_passThroughController.node])); | 315 new Set<AssetNode>.from([_passThroughController.node])); |
| 308 } | 316 } |
| 309 | 317 |
| 310 return Future.wait(_transforms.map((transform) { | 318 return Future.wait(_transforms.map((transform) { |
| 311 if (!transform.isDirty) return new Future.value(new Set()); | 319 if (!transform.isDirty) return new Future.value(new Set()); |
| 312 return transform.apply(); | 320 return transform.apply(); |
| 313 })).then((outputs) => unionAll(outputs)); | 321 })).then((outputs) => unionAll(outputs)); |
| 314 } | 322 } |
| 315 } | 323 } |
| OLD | NEW |