| 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.transform_node; | 5 library barback.transform_node; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_graph.dart'; | 10 import 'asset_graph.dart'; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Watch any new inputs so this transform will be re-processed when an | 79 // Watch any new inputs so this transform will be re-processed when an |
| 80 // input is modified. | 80 // input is modified. |
| 81 for (var newInput in newInputs) { | 81 for (var newInput in newInputs) { |
| 82 newInput.consumers.add(this); | 82 newInput.consumers.add(this); |
| 83 } | 83 } |
| 84 | 84 |
| 85 _inputs = newInputs; | 85 _inputs = newInputs; |
| 86 | 86 |
| 87 // See which outputs are missing from the last run. | 87 // See which outputs are missing from the last run. |
| 88 var outputIds = newOutputs.map((asset) => asset.id).toSet(); | 88 var outputIds = newOutputs.map((asset) => asset.id).toSet(); |
| 89 var invalidIds = outputIds |
| 90 .where((id) => id.package != phase.graph.package).toSet(); |
| 91 outputIds.removeAll(invalidIds); |
| 92 |
| 93 for (var id in invalidIds) { |
| 94 // TODO(nweiz): report this as a warning rather than a failing error. |
| 95 phase.graph.reportError( |
| 96 new InvalidOutputException(phase.graph.package, id)); |
| 97 } |
| 98 |
| 89 var removed = _outputs.difference(outputIds); | 99 var removed = _outputs.difference(outputIds); |
| 90 _outputs = outputIds; | 100 _outputs = outputIds; |
| 91 | 101 |
| 92 return new TransformOutputs(newOutputs, removed); | 102 return new TransformOutputs(newOutputs, removed); |
| 93 }); | 103 }); |
| 94 } | 104 } |
| 95 } | 105 } |
| 96 | 106 |
| 97 /// The result of running a [Transform], compared to the previous time it was | 107 /// The result of running a [Transform], compared to the previous time it was |
| 98 /// applied. | 108 /// applied. |
| 99 class TransformOutputs { | 109 class TransformOutputs { |
| 100 /// The outputs that are new or were modified since the last run. | 110 /// The outputs that are new or were modified since the last run. |
| 101 final AssetSet updated; | 111 final AssetSet updated; |
| 102 | 112 |
| 103 /// The outputs that were created by the previous run but were not generated | 113 /// The outputs that were created by the previous run but were not generated |
| 104 /// by the most recent run. | 114 /// by the most recent run. |
| 105 final Set<AssetId> removed; | 115 final Set<AssetId> removed; |
| 106 | 116 |
| 107 TransformOutputs(this.updated, this.removed); | 117 TransformOutputs(this.updated, this.removed); |
| 108 } | 118 } |
| OLD | NEW |