Don't return outputs from a removed PhaseInput.
Also clean up a few things in Phase. R=alanknight@google.com Review URL: https://codereview.chromium.org//37813002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29127 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -281,13 +281,11 @@ class Phase {
|
||||
if (!input.isDirty) return new Future.value(new Set());
|
||||
return input.process().then(_handleOutputs);
|
||||
}));
|
||||
outputFutures.addAll(_groups.values.map((input) {
|
||||
if (!input.isDirty) return new Future.value(new Set());
|
||||
return input.process().then(_handleOutputs);
|
||||
outputFutures.addAll(_groups.values.map((group) {
|
||||
if (!group.isDirty) return new Future.value(new Set());
|
||||
return group.process().then(_handleOutputs);
|
||||
}));
|
||||
|
||||
// TODO(nweiz): handle pass-through.
|
||||
|
||||
return Future.wait(outputFutures).then((_) {
|
||||
// Report collisions in a deterministic order.
|
||||
outputIds = outputIds.toList();
|
||||
|
||||
@@ -273,9 +273,15 @@ class PhaseInput {
|
||||
}
|
||||
|
||||
/// Processes the transforms for this input.
|
||||
///
|
||||
/// Returns the set of newly-created asset nodes that transforms have emitted
|
||||
/// for this input. The assets returned this way are guaranteed not to be
|
||||
/// [AssetState.REMOVED].
|
||||
Future<Set<AssetNode>> process() {
|
||||
if (_adjustTransformersFuture == null) return _processTransforms();
|
||||
return _waitForTransformers(() => _processTransforms());
|
||||
return _waitForTransformers(() => _processTransforms()).then((outputs) {
|
||||
if (input.state.isRemoved) return new Set();
|
||||
return outputs;
|
||||
});
|
||||
}
|
||||
|
||||
/// Runs [callback] once all the transformers are adjusted correctly and the
|
||||
|
||||
@@ -806,6 +806,30 @@ main() {
|
||||
buildShouldSucceed();
|
||||
});
|
||||
|
||||
test("one transformer takes a long time while the other finishes, then "
|
||||
"the input is removed", () {
|
||||
var rewrite1 = new RewriteTransformer("txt", "out1");
|
||||
var rewrite2 = new RewriteTransformer("txt", "out2");
|
||||
initGraph(["app|foo.txt"], {"app": [[rewrite1, rewrite2]]});
|
||||
|
||||
rewrite1.pauseApply();
|
||||
|
||||
updateSources(["app|foo.txt"]);
|
||||
|
||||
// Wait for rewrite1 to pause and rewrite2 to finish.
|
||||
schedule(pumpEventQueue);
|
||||
|
||||
removeSources(["app|foo.txt"]);
|
||||
|
||||
// Make sure the removal is processed completely before we restart rewrite2.
|
||||
schedule(pumpEventQueue);
|
||||
rewrite1.resumeApply();
|
||||
|
||||
buildShouldSucceed();
|
||||
expectNoAsset("app|foo.out1");
|
||||
expectNoAsset("app|foo.out2");
|
||||
});
|
||||
|
||||
group("pass-through", () {
|
||||
test("passes an asset through a phase in which no transforms apply", () {
|
||||
initGraph([
|
||||
|
||||
Reference in New Issue
Block a user