diff options
author | Lukacs Berki <lberki@google.com> | 2017-02-28 10:46:53 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-02-28 11:33:55 +0000 |
commit | 5ea2b14a9cece2e42779a8b3e4e8f3483e991ee1 (patch) | |
tree | ce979a2de599144bc8f6b33a48f2e7b562e7ca81 /src/main/java/com/google/devtools/build/lib/rules/extra | |
parent | 8afbd3c65339665992ece415e268955394507559 (diff) |
Clean up the semantics of input discovering actions a bit by making updateInputs() and inputsKnown() non-overridable and removing setInputs().
This comes at the cost of adding a flag to every action instance that's not used for non-input-discovering actions, but I think that's a deal. Simpler APIs are good, mmmmkay?
Also fixed a few pre-existing issues in TestAction and ObjcCompileAction.
--
PiperOrigin-RevId: 148749734
MOS_MIGRATED_REVID=148749734
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/extra')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java index a293b00497..b2f7fdbbac 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java @@ -41,7 +41,6 @@ import java.util.Collection; import java.util.Map; import java.util.Set; import javax.annotation.Nullable; -import javax.annotation.concurrent.GuardedBy; /** * Action used by extra_action rules to create an action that shadows an existing action. Runs a @@ -54,10 +53,6 @@ public final class ExtraAction extends SpawnAction { private final ImmutableSet<Artifact> extraActionInputs; private final Iterable<Artifact> originalShadowedActionInputs; - // This can be read/written from multiple threads, and so accesses should be synchronized. - @GuardedBy("this") - private boolean inputsKnown; - /** * A long way to say (ExtraAction xa) -> xa.getShadowedAction(). */ @@ -104,7 +99,6 @@ public final class ExtraAction extends SpawnAction { this.createDummyOutput = createDummyOutput; this.extraActionInputs = extraActionInputs; - inputsKnown = shadowedAction.inputsKnown(); if (createDummyOutput) { // Expecting just a single dummy file in the outputs. Preconditions.checkArgument(outputs.size() == 1, outputs); @@ -123,7 +117,7 @@ public final class ExtraAction extends SpawnAction { Preconditions.checkState(discoversInputs(), this); // We depend on the outputs of actions doing input discovery and they should know their inputs // after having been executed - Preconditions.checkState(shadowedAction.inputsKnown()); + Preconditions.checkState(shadowedAction.inputsDiscovered()); // We need to update our inputs to take account of any additional // inputs the shadowed action may need to do its work. @@ -132,11 +126,6 @@ public final class ExtraAction extends SpawnAction { ImmutableSet.copyOf(originalShadowedActionInputs)); } - @Override - public synchronized boolean inputsKnown() { - return inputsKnown; - } - private static NestedSet<Artifact> createInputs( Iterable<Artifact> shadowedActionInputs, ImmutableSet<Artifact> extraActionInputs, @@ -152,12 +141,6 @@ public final class ExtraAction extends SpawnAction { } @Override - public synchronized void updateInputs(Iterable<Artifact> discoveredInputs) { - setInputs(discoveredInputs); - inputsKnown = true; - } - - @Override public Iterable<Artifact> getAllowedDerivedInputs() { return shadowedAction.getAllowedDerivedInputs(); } @@ -189,9 +172,6 @@ public final class ExtraAction extends SpawnAction { } } } - synchronized (this) { - inputsKnown = true; - } } /** |