| 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.graph.package_graph; | 5 library barback.graph.package_graph; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import '../asset/asset_id.dart'; | 10 import '../asset/asset_id.dart'; |
| 11 import '../asset/asset_node.dart'; | 11 import '../asset/asset_node.dart'; |
| 12 import '../asset/asset_set.dart'; | 12 import '../asset/asset_set.dart'; |
| 13 import '../build_result.dart'; | 13 import '../build_result.dart'; |
| 14 import '../errors.dart'; | 14 import '../errors.dart'; |
| 15 import '../log.dart'; | 15 import '../log.dart'; |
| 16 import '../package_provider.dart'; | 16 import '../package_provider.dart'; |
| 17 import '../transformer/transformer.dart'; | |
| 18 import '../utils.dart'; | 17 import '../utils.dart'; |
| 19 import 'asset_cascade.dart'; | 18 import 'asset_cascade.dart'; |
| 20 import 'node_status.dart'; | 19 import 'node_status.dart'; |
| 21 | 20 |
| 22 /// The collection of [AssetCascade]s for an entire application. | 21 /// The collection of [AssetCascade]s for an entire application. |
| 23 /// | 22 /// |
| 24 /// This tracks each package's [AssetCascade] and routes asset requests between | 23 /// This tracks each package's [AssetCascade] and routes asset requests between |
| 25 /// them. | 24 /// them. |
| 26 class PackageGraph { | 25 class PackageGraph { |
| 27 /// The provider that exposes asset and package information. | 26 /// The provider that exposes asset and package information. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 var cascade = _cascades[package]; | 176 var cascade = _cascades[package]; |
| 178 if (cascade == null) throw new ArgumentError("Unknown package $package."); | 177 if (cascade == null) throw new ArgumentError("Unknown package $package."); |
| 179 _inErrorZone(() => cascade.removeSources(ids)); | 178 _inErrorZone(() => cascade.removeSources(ids)); |
| 180 }); | 179 }); |
| 181 | 180 |
| 182 // It's possible for removing sources not to cause any processing. The user | 181 // It's possible for removing sources not to cause any processing. The user |
| 183 // still expects there to be a build, though, so we emit one immediately. | 182 // still expects there to be a build, though, so we emit one immediately. |
| 184 _tryScheduleResult(); | 183 _tryScheduleResult(); |
| 185 } | 184 } |
| 186 | 185 |
| 187 void updateTransformers(String package, | 186 void updateTransformers(String package, Iterable<Iterable> transformers) { |
| 188 Iterable<Iterable<Transformer>> transformers) { | |
| 189 _inErrorZone(() => _cascades[package].updateTransformers(transformers)); | 187 _inErrorZone(() => _cascades[package].updateTransformers(transformers)); |
| 190 | 188 |
| 191 // It's possible for updating transformers not to cause any processing. The | 189 // It's possible for updating transformers not to cause any processing. The |
| 192 // user still expects there to be a build, though, so we emit one | 190 // user still expects there to be a build, though, so we emit one |
| 193 // immediately. | 191 // immediately. |
| 194 _tryScheduleResult(); | 192 _tryScheduleResult(); |
| 195 } | 193 } |
| 196 | 194 |
| 197 /// A handler for a log entry from an [AssetCascade]. | 195 /// A handler for a log entry from an [AssetCascade]. |
| 198 void _onLog(LogEntry entry) { | 196 void _onLog(LogEntry entry) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 completer.completeError(error, stackTrace); | 253 completer.completeError(error, stackTrace); |
| 256 }); | 254 }); |
| 257 }, onError: (error, stackTrace) { | 255 }, onError: (error, stackTrace) { |
| 258 _lastUnexpectedError = error; | 256 _lastUnexpectedError = error; |
| 259 _lastUnexpectedErrorTrace = stackTrace; | 257 _lastUnexpectedErrorTrace = stackTrace; |
| 260 _resultsController.addError(error, stackTrace); | 258 _resultsController.addError(error, stackTrace); |
| 261 }); | 259 }); |
| 262 return completer.future; | 260 return completer.future; |
| 263 } | 261 } |
| 264 } | 262 } |
| OLD | NEW |