Chromium Code Reviews| 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.barback; | 5 library barback.barback; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 | 57 |
| 58 /// A stream that emits any errors from the graph or the transformers. | 58 /// A stream that emits any errors from the graph or the transformers. |
| 59 /// | 59 /// |
| 60 /// This emits errors as they're detected. If an error occurs in one part of | 60 /// This emits errors as they're detected. If an error occurs in one part of |
| 61 /// the graph, unrelated parts will continue building. | 61 /// the graph, unrelated parts will continue building. |
| 62 /// | 62 /// |
| 63 /// This will not emit programming errors from barback itself. Those will be | 63 /// This will not emit programming errors from barback itself. Those will be |
| 64 /// emitted through the [results] stream's error channel. | 64 /// emitted through the [results] stream's error channel. |
| 65 Stream get errors => _graph.errors; | 65 Stream get errors => _graph.errors; |
| 66 | 66 |
| 67 Barback(PackageProvider provider) | 67 Barback(PackageProvider provider, {BarbackLogger logger}) |
|
nweiz
2013/10/16 19:41:27
I'm not a big fan of using injection here. What do
Bob Nystrom
2013/10/28 23:45:56
I thought about that (and it is using streams inte
nweiz
2013/10/29 00:40:13
There's some precedent for this in that buffered s
Bob Nystrom
2013/10/29 18:29:45
Done.
| |
| 68 : _graph = new PackageGraph(provider); | 68 : _graph = new PackageGraph(provider, logger: logger); |
| 69 | 69 |
| 70 /// Gets the asset identified by [id]. | 70 /// Gets the asset identified by [id]. |
| 71 /// | 71 /// |
| 72 /// If [id] is for a generated or transformed asset, this will wait until | 72 /// If [id] is for a generated or transformed asset, this will wait until |
| 73 /// it has been created and return it. If the asset cannot be found, throws | 73 /// it has been created and return it. If the asset cannot be found, throws |
| 74 /// [AssetNotFoundException]. | 74 /// [AssetNotFoundException]. |
| 75 Future<Asset> getAssetById(AssetId id) { | 75 Future<Asset> getAssetById(AssetId id) { |
| 76 return _graph.getAssetNode(id).then((node) { | 76 return _graph.getAssetNode(id).then((node) { |
| 77 if (node == null) throw new AssetNotFoundException(id); | 77 if (node == null) throw new AssetNotFoundException(id); |
| 78 return node.asset; | 78 return node.asset; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 102 /// | 102 /// |
| 103 /// To the extent that [transformers] is similar to the previous transformer | 103 /// To the extent that [transformers] is similar to the previous transformer |
| 104 /// phases for [package], the existing asset graph will be preserved. | 104 /// phases for [package], the existing asset graph will be preserved. |
| 105 /// | 105 /// |
| 106 /// Elements of the inner iterable of [transformers] must be either | 106 /// Elements of the inner iterable of [transformers] must be either |
| 107 /// [Transformer]s or [TransformerGroup]s. | 107 /// [Transformer]s or [TransformerGroup]s. |
| 108 void updateTransformers(String package, | 108 void updateTransformers(String package, |
| 109 Iterable<Iterable> transformers) => | 109 Iterable<Iterable> transformers) => |
| 110 _graph.updateTransformers(package, transformers); | 110 _graph.updateTransformers(package, transformers); |
| 111 } | 111 } |
| OLD | NEW |