aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-11-02 15:02:00 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-11-02 16:57:26 +0000
commit093d995cf1298aadedb0e39356dc61bb0db403dc (patch)
treee10fb3e934402c990944f32c6005656ef1a0db2e /src/main/java/com/google/devtools/build/lib
parentc33e3738b43835e5dcc35dce2ea6653ec0e6497a (diff)
Move LoadingPhaseRunner.Callback to the top-level class LoadingCallback.
-- MOS_MIGRATED_REVID=106839024
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/LoadingCallback.java40
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunner.java26
3 files changed, 45 insertions, 25 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java
index c3b2dad94c..8a7477f032 100644
--- a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java
+++ b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java
@@ -64,8 +64,8 @@ import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.packages.TargetUtils;
import com.google.devtools.build.lib.pkgcache.LoadedPackageProvider;
+import com.google.devtools.build.lib.pkgcache.LoadingCallback;
import com.google.devtools.build.lib.pkgcache.LoadingFailedException;
-import com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner.Callback;
import com.google.devtools.build.lib.pkgcache.LoadingResult;
import com.google.devtools.build.lib.profiler.ProfilePhase;
import com.google.devtools.build.lib.profiler.Profiler;
@@ -384,7 +384,7 @@ public final class BuildTool {
final boolean keepGoing = request.getViewOptions().keepGoing;
- Callback callback = new Callback() {
+ LoadingCallback callback = new LoadingCallback() {
@Override
public void notifyTargets(Collection<Target> targets) throws LoadingFailedException {
if (validator != null) {
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingCallback.java b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingCallback.java
new file mode 100644
index 0000000000..5b4538399c
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingCallback.java
@@ -0,0 +1,40 @@
+// Copyright 2015 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.pkgcache;
+
+import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.packages.Target;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * A callback interface to notify the caller about specific events.
+ * TODO(bazel-team): maybe we should use the EventBus instead?
+ */
+public interface LoadingCallback {
+ /**
+ * Called after the target patterns have been resolved to give the caller a chance to validate
+ * the list before proceeding.
+ */
+ void notifyTargets(Collection<Target> targets) throws LoadingFailedException;
+
+ /**
+ * Called after loading has finished, to notify the caller about the visited packages.
+ *
+ * <p>The set of visited packages is the set of packages in the transitive closure of the
+ * union of the top level targets.
+ */
+ void notifyVisitedPackages(Set<PackageIdentifier> visitedPackages);
+} \ No newline at end of file
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunner.java b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunner.java
index 04da44844f..51700a3c58 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunner.java
@@ -69,26 +69,6 @@ import javax.annotation.Nullable;
*/
public final class LoadingPhaseRunner {
- /**
- * A callback interface to notify the caller about specific events.
- * TODO(bazel-team): maybe we should use the EventBus instead?
- */
- public interface Callback {
- /**
- * Called after the target patterns have been resolved to give the caller a chance to validate
- * the list before proceeding.
- */
- void notifyTargets(Collection<Target> targets) throws LoadingFailedException;
-
- /**
- * Called after loading has finished, to notify the caller about the visited packages.
- *
- * <p>The set of visited packages is the set of packages in the transitive closure of the
- * union of the top level targets.
- */
- void notifyVisitedPackages(Set<PackageIdentifier> visitedPackages);
- }
-
private static final class ParseFailureListenerImpl extends DelegatingEventHandler
implements ParseFailureListener {
private final EventBus eventBus;
@@ -135,7 +115,7 @@ public final class LoadingPhaseRunner {
public LoadingResult execute(EventHandler eventHandler, EventBus eventBus,
List<String> targetPatterns, LoadingOptions options,
ListMultimap<String, Label> labelsToLoadUnconditionally, boolean keepGoing,
- boolean enableLoading, boolean determineTests, @Nullable Callback callback)
+ boolean enableLoading, boolean determineTests, @Nullable LoadingCallback callback)
throws TargetParsingException, LoadingFailedException, InterruptedException {
LOG.info("Starting pattern evaluation");
Stopwatch timer = Stopwatch.createStarted();
@@ -225,7 +205,7 @@ public final class LoadingPhaseRunner {
}
}
- private void freeMemoryAfterLoading(Callback callback, Set<PackageIdentifier> visitedPackages) {
+ private void freeMemoryAfterLoading(LoadingCallback callback, Set<PackageIdentifier> visitedPackages) {
if (callback != null) {
callback.notifyVisitedPackages(visitedPackages);
}
@@ -264,7 +244,7 @@ public final class LoadingPhaseRunner {
private LoadingResult doLoadingPhase(EventHandler eventHandler, EventBus eventBus,
ResolvedTargets<Target> targets, ImmutableSet<Target> testsToRun,
ListMultimap<String, Label> labelsToLoadUnconditionally, boolean keepGoing,
- int loadingPhaseThreads, @Nullable Callback callback)
+ int loadingPhaseThreads, @Nullable LoadingCallback callback)
throws InterruptedException, LoadingFailedException {
Stopwatch timer = preLoadingLogging(eventHandler);