| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.graph.static_asset_cascade; | 5 library barback.graph.static_asset_cascade; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import '../asset/asset_id.dart'; | 9 import '../asset/asset_id.dart'; |
| 10 import '../asset/asset_node.dart'; | 10 import '../asset/asset_node.dart'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 final _errorsController = | 35 final _errorsController = |
| 36 new StreamController<BarbackException>.broadcast(sync: true); | 36 new StreamController<BarbackException>.broadcast(sync: true); |
| 37 | 37 |
| 38 final status = NodeStatus.IDLE; | 38 final status = NodeStatus.IDLE; |
| 39 | 39 |
| 40 final onLog = new StreamController<LogEntry>.broadcast().stream; | 40 final onLog = new StreamController<LogEntry>.broadcast().stream; |
| 41 final onStatusChange = new StreamController<LogEntry>.broadcast().stream; | 41 final onStatusChange = new StreamController<LogEntry>.broadcast().stream; |
| 42 | 42 |
| 43 Future<AssetSet> get availableOutputs { | 43 Future<AssetSet> get availableOutputs { |
| 44 var provider = graph.provider as StaticPackageProvider; | 44 var provider = graph.provider as StaticPackageProvider; |
| 45 return provider.getAllAssetIds(package).map(provider.getAsset).toList() | 45 return provider.getAllAssetIds(package).asyncMap(provider.getAsset).toList() |
| 46 .then((assets) => new AssetSet.from(assets)); | 46 .then((assets) => new AssetSet.from(assets)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Future<AssetNode> getAssetNode(AssetId id) { | 49 Future<AssetNode> getAssetNode(AssetId id) { |
| 50 return _sources.putIfAbsent(id, () { | 50 return _sources.putIfAbsent(id, () { |
| 51 return graph.provider.getAsset(id).then((asset) { | 51 return graph.provider.getAsset(id).then((asset) { |
| 52 return new AssetNodeController.available(asset).node; | 52 return new AssetNodeController.available(asset).node; |
| 53 }).catchError((error, stackTrace) { | 53 }).catchError((error, stackTrace) { |
| 54 if (error is! AssetNotFoundException) { | 54 if (error is! AssetNotFoundException) { |
| 55 reportError(new AssetLoadException(id, error, stackTrace)); | 55 reportError(new AssetLoadException(id, error, stackTrace)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 72 void updateTransformers(Iterable<Iterable> transformersIterable) => | 72 void updateTransformers(Iterable<Iterable> transformersIterable) => |
| 73 throw new UnsupportedError("Static package $package can't have " | 73 throw new UnsupportedError("Static package $package can't have " |
| 74 "transformers."); | 74 "transformers."); |
| 75 | 75 |
| 76 void forceAllTransforms() {} | 76 void forceAllTransforms() {} |
| 77 | 77 |
| 78 void reportError(BarbackException error) => _errorsController.add(error); | 78 void reportError(BarbackException error) => _errorsController.add(error); |
| 79 | 79 |
| 80 String toString() => "static cascade for $package"; | 80 String toString() => "static cascade for $package"; |
| 81 } | 81 } |
| OLD | NEW |