| 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.asset_cascade; | 5 library barback.asset_cascade; |
| 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'; |
| 11 import 'asset_id.dart'; | 11 import 'asset_id.dart'; |
| 12 import 'asset_node.dart'; | 12 import 'asset_node.dart'; |
| 13 import 'asset_set.dart'; |
| 13 import 'build_result.dart'; | 14 import 'build_result.dart'; |
| 14 import 'cancelable_future.dart'; | 15 import 'cancelable_future.dart'; |
| 15 import 'errors.dart'; | 16 import 'errors.dart'; |
| 16 import 'package_graph.dart'; | 17 import 'package_graph.dart'; |
| 17 import 'phase.dart'; | 18 import 'phase.dart'; |
| 18 import 'transformer.dart'; | 19 import 'transformer.dart'; |
| 19 import 'utils.dart'; | 20 import 'utils.dart'; |
| 20 | 21 |
| 21 /// The asset cascade for an individual package. | 22 /// The asset cascade for an individual package. |
| 22 /// | 23 /// |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 76 |
| 76 /// A future that completes when the currently running build process finishes. | 77 /// A future that completes when the currently running build process finishes. |
| 77 /// | 78 /// |
| 78 /// If no build it in progress, is `null`. | 79 /// If no build it in progress, is `null`. |
| 79 Future _processDone; | 80 Future _processDone; |
| 80 | 81 |
| 81 /// Whether any source assets have been updated or removed since processing | 82 /// Whether any source assets have been updated or removed since processing |
| 82 /// last began. | 83 /// last began. |
| 83 var _newChanges = false; | 84 var _newChanges = false; |
| 84 | 85 |
| 86 /// Returns all currently-available output assets from this cascade. |
| 87 AssetSet get availableOutputs => _phases.last.availableOutputs; |
| 88 |
| 85 /// Creates a new [AssetCascade]. | 89 /// Creates a new [AssetCascade]. |
| 86 /// | 90 /// |
| 87 /// It loads source assets within [package] using [provider] and then uses | 91 /// It loads source assets within [package] using [provider] and then uses |
| 88 /// [transformerPhases] to generate output files from them. | 92 /// [transformerPhases] to generate output files from them. |
| 89 //TODO(rnystrom): Better way of specifying transformers and their ordering. | 93 //TODO(rnystrom): Better way of specifying transformers and their ordering. |
| 90 AssetCascade(this.graph, this.package, | 94 AssetCascade(this.graph, this.package, |
| 91 Iterable<Iterable<Transformer>> transformerPhases) { | 95 Iterable<Iterable<Transformer>> transformerPhases) { |
| 92 // Flatten the phases to a list so we can traverse backwards to wire up | 96 // Flatten the phases to a list so we can traverse backwards to wire up |
| 93 // each phase to its next. | 97 // each phase to its next. |
| 94 var phases = transformerPhases.toList(); | 98 var phases = transformerPhases.toList(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 245 |
| 242 // Otherwise, everything is done. | 246 // Otherwise, everything is done. |
| 243 return; | 247 return; |
| 244 } | 248 } |
| 245 | 249 |
| 246 // Process that phase and then loop onto the next. | 250 // Process that phase and then loop onto the next. |
| 247 return future.then((_) => _process()); | 251 return future.then((_) => _process()); |
| 248 }); | 252 }); |
| 249 } | 253 } |
| 250 } | 254 } |
| OLD | NEW |