aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/skyframe
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-06-04 12:50:13 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-04 12:52:14 -0700
commit61377f7e0b31d47d27b184edf928f2c446da0867 (patch)
treeeaf7ee9db34aac2b3d1f19e6bf8d85bb79584e82 /src/main/java/com/google/devtools/build/skyframe
parentf4cf006a4e1189b1ff6c757a90af22038fa6b943 (diff)
Remove ConfiguredTarget from TargetCompletionValue, since it is no longer needed: we can get the ConfiguredTargetKey directly from the TargetCompletionKey. Since that was the only use of the actual value in EvaluationProgressReceiver#evaluated, remove it, instead just provide a boolean enum that gives whether or not evaluation succeeded.
PiperOrigin-RevId: 199178047
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe')
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java6
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java2
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java9
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java8
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java37
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/EvaluationSuccessStateSupplier.java (renamed from src/main/java/com/google/devtools/build/skyframe/SkyValueSupplier.java)15
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java2
7 files changed, 57 insertions, 22 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java
index 43068fe839..7771d833ec 100644
--- a/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.skyframe;
import com.google.common.base.Preconditions;
-import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -25,6 +24,7 @@ import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.ProfilerTask;
import com.google.devtools.build.lib.util.GroupedList;
import com.google.devtools.build.skyframe.EvaluationProgressReceiver.EvaluationState;
+import com.google.devtools.build.skyframe.EvaluationProgressReceiver.EvaluationSuccessState;
import com.google.devtools.build.skyframe.MemoizingEvaluator.EmittedEventState;
import com.google.devtools.build.skyframe.NodeEntry.DependencyState;
import com.google.devtools.build.skyframe.QueryableGraph.Reason;
@@ -156,7 +156,9 @@ public abstract class AbstractExceptionalParallelEvaluator<E extends Exception>
.getProgressReceiver()
.evaluated(
key,
- Suppliers.ofInstance(value),
+ value != null
+ ? EvaluationSuccessState.SUCCESS.supplier()
+ : EvaluationSuccessState.FAILURE.supplier(),
valueVersion.equals(evaluatorContext.getGraphVersion())
? EvaluationState.BUILT
: EvaluationState.CLEAN);
diff --git a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
index 5cb810f699..2373959857 100644
--- a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
@@ -286,7 +286,7 @@ public abstract class AbstractParallelEvaluator {
// Tell the receiver that the value was not actually changed this run.
evaluatorContext
.getProgressReceiver()
- .evaluated(skyKey, new SkyValueSupplier(state), EvaluationState.CLEAN);
+ .evaluated(skyKey, new EvaluationSuccessStateSupplier(state), EvaluationState.CLEAN);
if (!evaluatorContext.keepGoing() && state.getErrorInfo() != null) {
if (!evaluatorContext.getVisitor().preventNewEvaluations()) {
return DirtyOutcome.ALREADY_PROCESSED;
diff --git a/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java
index 894df66fda..9f54ca0f57 100644
--- a/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java
+++ b/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java
@@ -13,8 +13,8 @@
// limitations under the License.
package com.google.devtools.build.skyframe;
-import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
+import java.util.function.Supplier;
/**
* An {@link EvaluationProgressReceiver} that delegates to a bunch of other
@@ -61,9 +61,12 @@ public class CompoundEvaluationProgressReceiver implements EvaluationProgressRec
}
@Override
- public void evaluated(SkyKey skyKey, Supplier<SkyValue> valueSupplier, EvaluationState state) {
+ public void evaluated(
+ SkyKey skyKey,
+ Supplier<EvaluationSuccessState> evaluationSuccessState,
+ EvaluationState state) {
for (EvaluationProgressReceiver receiver : receivers) {
- receiver.evaluated(skyKey, valueSupplier, state);
+ receiver.evaluated(skyKey, evaluationSuccessState, state);
}
}
}
diff --git a/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java
index 22f9dfba1d..820fb51cfe 100644
--- a/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java
+++ b/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java
@@ -13,10 +13,10 @@
// limitations under the License.
package com.google.devtools.build.skyframe;
-import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.util.Set;
+import java.util.function.Supplier;
import javax.annotation.Nullable;
/**
@@ -106,10 +106,12 @@ public class DirtyTrackingProgressReceiver implements EvaluationProgressReceiver
}
@Override
- public void evaluated(SkyKey skyKey, Supplier<SkyValue> valueSupplier,
+ public void evaluated(
+ SkyKey skyKey,
+ Supplier<EvaluationSuccessState> evaluationSuccessState,
EvaluationState state) {
if (progressReceiver != null) {
- progressReceiver.evaluated(skyKey, valueSupplier, state);
+ progressReceiver.evaluated(skyKey, evaluationSuccessState, state);
}
// This key was either built or marked clean, so we can remove it from both the dirty and
diff --git a/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java
index 2844ec4f45..d93812b139 100644
--- a/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java
+++ b/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java
@@ -13,8 +13,8 @@
// limitations under the License.
package com.google.devtools.build.skyframe;
-import com.google.common.base.Supplier;
import com.google.devtools.build.lib.concurrent.ThreadSafety;
+import java.util.function.Supplier;
/** Receiver for various stages of the lifetime of a skyframe node evaluation. */
@ThreadSafety.ThreadSafe
@@ -29,6 +29,26 @@ public interface EvaluationProgressReceiver {
CLEAN,
}
+ /** Whether or not evaluation of this node succeeded. */
+ enum EvaluationSuccessState {
+ SUCCESS(true),
+ FAILURE(false);
+
+ EvaluationSuccessState(boolean succeeded) {
+ this.succeeded = succeeded;
+ }
+
+ private final boolean succeeded;
+
+ public boolean succeeded() {
+ return succeeded;
+ }
+
+ public Supplier<EvaluationSuccessState> supplier() {
+ return () -> this;
+ }
+ }
+
/**
* New state of the value entry after invalidation.
*/
@@ -97,10 +117,13 @@ public interface EvaluationProgressReceiver {
*
* <p>{@code state} indicates the new state of the node.
*
- * <p>If the value builder threw an error when building this node, then
- * {@code valueSupplier.get()} evaluates to null.
+ * <p>If the value builder threw an error when building this node, then {@code
+ * valueSupplier.get()} evaluates to null.
*/
- void evaluated(SkyKey skyKey, Supplier<SkyValue> valueSupplier, EvaluationState state);
+ void evaluated(
+ SkyKey skyKey,
+ Supplier<EvaluationSuccessState> evaluationSuccessState,
+ EvaluationState state);
/** An {@link EvaluationProgressReceiver} that does nothing. */
class NullEvaluationProgressReceiver implements EvaluationProgressReceiver {
@@ -121,7 +144,9 @@ public interface EvaluationProgressReceiver {
}
@Override
- public void evaluated(SkyKey skyKey, Supplier<SkyValue> valueSupplier, EvaluationState state) {
- }
+ public void evaluated(
+ SkyKey skyKey,
+ Supplier<EvaluationSuccessState> evaluationSuccessState,
+ EvaluationState state) {}
}
}
diff --git a/src/main/java/com/google/devtools/build/skyframe/SkyValueSupplier.java b/src/main/java/com/google/devtools/build/skyframe/EvaluationSuccessStateSupplier.java
index d05dbd729f..f4c320ca6e 100644
--- a/src/main/java/com/google/devtools/build/skyframe/SkyValueSupplier.java
+++ b/src/main/java/com/google/devtools/build/skyframe/EvaluationSuccessStateSupplier.java
@@ -14,22 +14,25 @@
package com.google.devtools.build.skyframe;
import com.google.common.base.Supplier;
+import com.google.devtools.build.skyframe.EvaluationProgressReceiver.EvaluationSuccessState;
/**
- * Supplier of {@link SkyValue} that crashes if its contained {@link NodeEntry} throws an {@link
- * InterruptedException} on value retrieval.
+ * Supplier of {@link EvaluationSuccessState} that crashes if its contained {@link NodeEntry} throws
+ * an {@link InterruptedException} on value retrieval.
*/
-class SkyValueSupplier implements Supplier<SkyValue> {
+class EvaluationSuccessStateSupplier implements Supplier<EvaluationSuccessState> {
private final NodeEntry state;
- SkyValueSupplier(NodeEntry state) {
+ EvaluationSuccessStateSupplier(NodeEntry state) {
this.state = state;
}
@Override
- public SkyValue get() {
+ public EvaluationSuccessState get() {
try {
- return state.getValue();
+ return state.getValue() != null
+ ? EvaluationSuccessState.SUCCESS
+ : EvaluationSuccessState.FAILURE;
} catch (InterruptedException e) {
throw new IllegalStateException(
"Graph implementations in which value retrieval can block should not be used in "
diff --git a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
index 905e822c57..67b7176193 100644
--- a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
+++ b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
@@ -562,7 +562,7 @@ class SkyFunctionEnvironment extends AbstractSkyFunctionEnvironment {
.getProgressReceiver()
.evaluated(
skyKey,
- new SkyValueSupplier(primaryEntry),
+ new EvaluationSuccessStateSupplier(primaryEntry),
valueVersion.equals(evaluatorContext.getGraphVersion())
? EvaluationState.BUILT
: EvaluationState.CLEAN);