aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-05-27 12:23:39 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-05-30 09:17:37 +0000
commit521510ac5a55dc84244d27c639d86a710d05148f (patch)
treec81f1748883ed26944d5ae02e1da9e208f70fbec /src
parentc6fd6bb3caa78518fbb9148d81efecdee540c29a (diff)
Remove now dead class LoadingProgressReceiver
With the change of reporting progress during loading and analysis by a custom package tracking class, the LoadingProgressReceiver is not used anywhere anymore. Threfore, remove it. -- Change-Id: Ia88d2d5608dea1bb395cd5b3c3e12c16200ecb41 Reviewed-on: https://bazel-review.googlesource.com/#/c/3701 MOS_MIGRATED_REVID=123410961
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiver.java76
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java18
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiverTest.java77
3 files changed, 2 insertions, 169 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiver.java b/src/main/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiver.java
deleted file mode 100644
index e7a4929c26..0000000000
--- a/src/main/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiver.java
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2016 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.skyframe;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Sets;
-import com.google.devtools.build.skyframe.EvaluationProgressReceiver;
-import com.google.devtools.build.skyframe.SkyKey;
-import com.google.devtools.build.skyframe.SkyValue;
-
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.Set;
-
-/**
- * An {@link EvaluationProgressReceiver} used during loading phase
- *
- * It receives updates about progress in the loading phase via the
- * {@link EvaluationProgressReceiver} interface. These updates get aggregated
- * and a summary of the current state of the loading phase can be obtained via
- * and provides a summary about the current state via the {@link #progressState}
- * method.
- */
-public class LoadingProgressReceiver implements EvaluationProgressReceiver {
-
- private final Set<SkyKey> enqueuedPackages = Sets.newConcurrentHashSet();
- private final Set<SkyKey> completedPackages = Sets.newConcurrentHashSet();
- private final Deque<SkyKey> pending = new ArrayDeque<>();
-
- @Override
- public void invalidated(SkyKey skyKey, InvalidationState state) {}
-
- @Override
- public synchronized void enqueueing(SkyKey skyKey) {
- if (skyKey.functionName().equals(SkyFunctions.PACKAGE)) {
- enqueuedPackages.add(skyKey);
- pending.addLast(skyKey);
- }
- }
-
- @Override
- public void computed(SkyKey skyKey, long elapsedTimeNanos) {}
-
- @Override
- public synchronized void evaluated(
- SkyKey skyKey, Supplier<SkyValue> valueSupplier, EvaluationState state) {
- if (skyKey.functionName().equals(SkyFunctions.PACKAGE)) {
- completedPackages.add(skyKey);
- pending.remove(skyKey);
- }
- }
-
- public synchronized String progressState() {
- long completed = completedPackages.size();
- long enqueued = enqueuedPackages.size();
- String answer = "" + completed + " / " + enqueued;
- if (enqueued > completed) {
- answer += " " + pending.peekFirst().toString();
- if (enqueued > completed + 1) {
- answer += " ... (" + pending.size() + " currently loading)";
- }
- }
- return answer;
- }
-}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
index 2246515a36..1b57421399 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
@@ -1736,16 +1736,9 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
options.buildTestsOnly, determineTests,
TestFilter.forOptions(options, eventHandler, ruleClassNames));
EvaluationResult<TargetPatternPhaseValue> evalResult;
- LoadingProgressReceiver loadingProgressReceiver = new LoadingProgressReceiver();
eventBus.post(new LoadingPhaseStartedEvent(packageProgress));
- progressReceiver.loadingProgressReceiver = loadingProgressReceiver;
- try {
- evalResult =
- buildDriver.evaluate(
- ImmutableList.of(key), keepGoing, /*numThreads=*/ 10, eventHandler);
- } finally {
- progressReceiver.loadingProgressReceiver = null;
- }
+ evalResult =
+ buildDriver.evaluate(ImmutableList.of(key), keepGoing, /*numThreads=*/ 10, eventHandler);
if (evalResult.hasError()) {
ErrorInfo errorInfo = evalResult.getError(key);
if (!Iterables.isEmpty(errorInfo.getCycleInfo())) {
@@ -1795,7 +1788,6 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
/** This receiver is only needed for execution, so it is null otherwise. */
@Nullable EvaluationProgressReceiver executionProgressReceiver = null;
/** This receiver is only needed for loading, so it is null otherwise. */
- @Nullable EvaluationProgressReceiver loadingProgressReceiver = null;
@Override
public void invalidated(SkyKey skyKey, InvalidationState state) {
@@ -1811,9 +1803,6 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
return;
}
skyframeBuildView.getInvalidationReceiver().enqueueing(skyKey);
- if (loadingProgressReceiver != null) {
- loadingProgressReceiver.enqueueing(skyKey);
- }
if (executionProgressReceiver != null) {
executionProgressReceiver.enqueueing(skyKey);
}
@@ -1828,9 +1817,6 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
return;
}
skyframeBuildView.getInvalidationReceiver().evaluated(skyKey, valueSupplier, state);
- if (loadingProgressReceiver != null) {
- loadingProgressReceiver.evaluated(skyKey, valueSupplier, state);
- }
if (executionProgressReceiver != null) {
executionProgressReceiver.evaluated(skyKey, valueSupplier, state);
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiverTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiverTest.java
deleted file mode 100644
index 21ab30718f..0000000000
--- a/src/test/java/com/google/devtools/build/lib/skyframe/LoadingProgressReceiverTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.skyframe;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.base.Supplier;
-import com.google.devtools.build.skyframe.EvaluationProgressReceiver;
-import com.google.devtools.build.skyframe.SkyKey;
-import com.google.devtools.build.skyframe.SkyValue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.mockito.Mockito;
-
-/**
- * Tests {@link LoadingProgressReceiver}
- */
-@RunWith(JUnit4.class)
-public class LoadingProgressReceiverTest {
-
- @Test
- public void testPackageVisible() {
- // If there is only one package being loaded, it should be visible
- // somewhere in the progress string.
- LoadingProgressReceiver progressReceiver = new LoadingProgressReceiver();
-
- String packageName = "//some/fancy/package/name";
- progressReceiver.enqueueing(SkyKey.create(SkyFunctions.PACKAGE, packageName));
- String state = progressReceiver.progressState();
-
- assertTrue(
- "Package name '" + packageName + "' should occour in state '" + state + "'",
- state.contains(packageName));
- }
-
- @Test
- public void testFinishedPackage() {
- // Consider the situation where two packages are loaded, and the one that
- // started loading second has already finished loading. ...
- LoadingProgressReceiver progressReceiver = new LoadingProgressReceiver();
-
- String packageName = "//some/fancy/package/name";
- String otherPackageName = "//some/other/unrelated/package";
- SkyKey otherKey = SkyKey.create(SkyFunctions.PACKAGE, otherPackageName);
- Supplier<SkyValue> valueSupplier = Mockito.mock(Supplier.class);
- progressReceiver.enqueueing(SkyKey.create(SkyFunctions.PACKAGE, packageName));
- progressReceiver.enqueueing(otherKey);
- progressReceiver.evaluated(
- otherKey, valueSupplier, EvaluationProgressReceiver.EvaluationState.BUILT);
- String state = progressReceiver.progressState();
-
- // ... Then, the finished package is not mentioned in the state,
- assertFalse(
- "Package name '" + otherPackageName + "' should not occur in state '" + state + "'",
- state.contains(otherPackageName));
- // the only running package is mentioned in the state, and
- assertTrue(
- "Package name '" + packageName + "' should occour in state '" + state + "'",
- state.contains(packageName));
- // the progress count is correct.
- assertTrue("Progress count should occur in state", state.contains("1 / 2"));
- }
-}