diff options
Diffstat (limited to 'src')
4 files changed, 25 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/InMemoryMemoizingEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/InMemoryMemoizingEvaluator.java index 87db734938..ad50bea196 100644 --- a/src/main/java/com/google/devtools/build/skyframe/InMemoryMemoizingEvaluator.java +++ b/src/main/java/com/google/devtools/build/skyframe/InMemoryMemoizingEvaluator.java @@ -17,7 +17,6 @@ import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; -import com.google.common.base.Receiver; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; @@ -29,6 +28,7 @@ import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DeletingInvali import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DirtyingInvalidationState; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.InvalidationState; import com.google.devtools.build.skyframe.NodeEntry.DependencyState; +import com.google.devtools.build.skyframe.ParallelEvaluator.Receiver; import java.io.PrintStream; import java.util.Collection; diff --git a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java index 18384c95b9..0ba0d79627 100644 --- a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java +++ b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java @@ -16,7 +16,6 @@ package com.google.devtools.build.skyframe; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import com.google.common.base.Receiver; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.base.Throwables; @@ -117,6 +116,17 @@ public final class ParallelEvaluator implements Evaluator { return state.getValue(); } } + + /** + * An general interface for ParalleelEvaluator to receive objects of type T. + */ + public interface Receiver<T> { + // TODO(dmarting): should we just make it a common object for all Bazel codebase? + /** + * Consumes the given object. + */ + void accept(T object); + } private final ImmutableMap<? extends SkyFunctionName, ? extends SkyFunction> skyFunctions; diff --git a/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java b/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java index 4c8cc1c8a8..623e08874c 100644 --- a/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.google.common.base.Preconditions; -import com.google.common.base.Receivers; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -148,7 +147,12 @@ public class EagerInvalidatorTest { 200, null, new DirtyKeyTrackerImpl(), - Receivers.<Collection<SkyKey>>ignore()); + new ParallelEvaluator.Receiver<Collection<SkyKey>>() { + @Override + public void accept(Collection<SkyKey> object) { + // ignore + } + }); graphVersion = graphVersion.next(); return evaluator.eval(ImmutableList.copyOf(keys)); } diff --git a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java index d9d5604942..45d7532b02 100644 --- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java @@ -30,7 +30,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.google.common.base.Predicate; -import com.google.common.base.Receivers; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -107,8 +106,7 @@ public class ParallelEvaluatorTest { Predicate<Event> storedEventFilter) { Version oldGraphVersion = graphVersion; graphVersion = graphVersion.next(); - return new ParallelEvaluator( - graph, + return new ParallelEvaluator(graph, oldGraphVersion, builders, reporter, @@ -118,7 +116,12 @@ public class ParallelEvaluatorTest { 150, revalidationReceiver, new DirtyKeyTrackerImpl(), - Receivers.<Collection<SkyKey>>ignore()); + new ParallelEvaluator.Receiver<Collection<SkyKey>>() { + @Override + public void accept(Collection<SkyKey> object) { + // ignore + } + }); } private ParallelEvaluator makeEvaluator(ProcessableGraph graph, |