| 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'; |
| 11 import 'asset_set.dart'; | 11 import 'asset_set.dart'; |
| 12 import 'barback_logger.dart'; | 12 import 'log.dart'; |
| 13 import 'build_result.dart'; | 13 import 'build_result.dart'; |
| 14 import 'errors.dart'; | 14 import 'errors.dart'; |
| 15 import 'package_graph.dart'; | 15 import 'package_graph.dart'; |
| 16 import 'package_provider.dart'; | 16 import 'package_provider.dart'; |
| 17 import 'transformer.dart'; | 17 import 'transformer.dart'; |
| 18 | 18 |
| 19 /// A general-purpose asynchronous build dependency graph manager. | 19 /// A general-purpose asynchronous build dependency graph manager. |
| 20 /// | 20 /// |
| 21 /// It consumes source assets (including Dart files) in a set of packages, | 21 /// It consumes source assets (including Dart files) in a set of packages, |
| 22 /// runs transformations on them, and then tracks which sources have been | 22 /// runs transformations on them, and then tracks which sources have been |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 /// A stream that emits any errors from the graph or the transformers. | 59 /// A stream that emits any errors from the graph or the transformers. |
| 60 /// | 60 /// |
| 61 /// This emits errors as they're detected. If an error occurs in one part of | 61 /// This emits errors as they're detected. If an error occurs in one part of |
| 62 /// the graph, unrelated parts will continue building. | 62 /// the graph, unrelated parts will continue building. |
| 63 /// | 63 /// |
| 64 /// This will not emit programming errors from barback itself. Those will be | 64 /// This will not emit programming errors from barback itself. Those will be |
| 65 /// emitted through the [results] stream's error channel. | 65 /// emitted through the [results] stream's error channel. |
| 66 Stream get errors => _graph.errors; | 66 Stream get errors => _graph.errors; |
| 67 | 67 |
| 68 Barback(PackageProvider provider, {BarbackLogger logger}) | 68 /// The stream of [LogEntry] objects used to report transformer log entries. |
| 69 : _graph = new PackageGraph(provider, logger: logger); | 69 /// |
| 70 /// If this stream has listeners, then log entries will go to that. |
| 71 /// Otherwise, a default logger will display them. |
| 72 Stream<LogEntry> get log => _graph.log; |
| 73 |
| 74 Barback(PackageProvider provider) |
| 75 : _graph = new PackageGraph(provider); |
| 70 | 76 |
| 71 /// Gets the asset identified by [id]. | 77 /// Gets the asset identified by [id]. |
| 72 /// | 78 /// |
| 73 /// If [id] is for a generated or transformed asset, this will wait until | 79 /// If [id] is for a generated or transformed asset, this will wait until |
| 74 /// it has been created and return it. If the asset cannot be found, throws | 80 /// it has been created and return it. If the asset cannot be found, throws |
| 75 /// [AssetNotFoundException]. | 81 /// [AssetNotFoundException]. |
| 76 Future<Asset> getAssetById(AssetId id) { | 82 Future<Asset> getAssetById(AssetId id) { |
| 77 return _graph.getAssetNode(id).then((node) { | 83 return _graph.getAssetNode(id).then((node) { |
| 78 if (node == null) throw new AssetNotFoundException(id); | 84 if (node == null) throw new AssetNotFoundException(id); |
| 79 return node.asset; | 85 return node.asset; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 103 /// | 109 /// |
| 104 /// To the extent that [transformers] is similar to the previous transformer | 110 /// To the extent that [transformers] is similar to the previous transformer |
| 105 /// phases for [package], the existing asset graph will be preserved. | 111 /// phases for [package], the existing asset graph will be preserved. |
| 106 /// | 112 /// |
| 107 /// Elements of the inner iterable of [transformers] must be either | 113 /// Elements of the inner iterable of [transformers] must be either |
| 108 /// [Transformer]s or [TransformerGroup]s. | 114 /// [Transformer]s or [TransformerGroup]s. |
| 109 void updateTransformers(String package, | 115 void updateTransformers(String package, |
| 110 Iterable<Iterable> transformers) => | 116 Iterable<Iterable> transformers) => |
| 111 _graph.updateTransformers(package, transformers); | 117 _graph.updateTransformers(package, transformers); |
| 112 } | 118 } |
| OLD | NEW |