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.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 = outputIds.removeAll(invalidIds); | |
| 92 | |
| 93 // TODO(nweiz): if there are invalid ids, do we consider the transform to | |
| 94 // have failed? | |
|
Bob Nystrom
2013/07/16 17:36:01
Probably not, I think.
nweiz
2013/07/16 19:39:39
Right now we have no means of reporting a bad cond
| |
| 95 for (var id in invalidIds) { | |
| 96 phase.graph.reportError( | |
| 97 new InvalidOutputException(phase.graph.package, id)); | |
| 98 } | |
| 99 | |
| 89 var removed = _outputs.difference(outputIds); | 100 var removed = _outputs.difference(outputIds); |
| 90 _outputs = outputIds; | 101 _outputs = outputIds; |
| 91 | 102 |
| 92 return new TransformOutputs(newOutputs, removed); | 103 return new TransformOutputs(newOutputs, removed); |
| 93 }); | 104 }); |
| 94 } | 105 } |
| 95 } | 106 } |
| 96 | 107 |
| 97 /// The result of running a [Transform], compared to the previous time it was | 108 /// The result of running a [Transform], compared to the previous time it was |
| 98 /// applied. | 109 /// applied. |
| 99 class TransformOutputs { | 110 class TransformOutputs { |
| 100 /// The outputs that are new or were modified since the last run. | 111 /// The outputs that are new or were modified since the last run. |
| 101 final AssetSet updated; | 112 final AssetSet updated; |
| 102 | 113 |
| 103 /// The outputs that were created by the previous run but were not generated | 114 /// The outputs that were created by the previous run but were not generated |
| 104 /// by the most recent run. | 115 /// by the most recent run. |
| 105 final Set<AssetId> removed; | 116 final Set<AssetId> removed; |
| 106 | 117 |
| 107 TransformOutputs(this.updated, this.removed); | 118 TransformOutputs(this.updated, this.removed); |
| 108 } | 119 } |
| OLD | NEW |