Revert output formatter part of https://github.com/bazelbuild/bazel/commit/92a872b4117de3937d7535976a387e8be4ca1f57
Turns out to be unnecessary as we already have a StreamedFormatter
interface. Also merge the GraphlessOutputFormatterTest into the
MiscOutputFormatterTest. We already use the streamed code path whenever
an output is selected that supports streaming and order_output=no. It's
almost as if someone started to implement streaming, but then didn't
finish it because query never actually streams results.
PiperOrigin-RevId: 251619094
diff --git a/src/main/java/com/google/devtools/build/lib/query2/query/output/OutputFormatter.java b/src/main/java/com/google/devtools/build/lib/query2/query/output/OutputFormatter.java
index 326abef..04deae5 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/query/output/OutputFormatter.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/query/output/OutputFormatter.java
@@ -18,7 +18,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -173,16 +172,6 @@
ConditionalEdges conditionalEdges)
throws IOException, InterruptedException;
- /** Format the result, and print it to "out". */
- public void outputUnordered(
- QueryOptions options,
- Iterable<Target> result,
- OutputStream out,
- AspectResolver aspectProvider)
- throws IOException, InterruptedException {
- throw new UnsupportedOperationException();
- }
-
/**
* Unordered streamed output formatter (wrt. dependency ordering).
*
@@ -257,19 +246,6 @@
: result.getTopologicalOrder(new TargetOrdering());
return Iterables.transform(orderedResult, EXTRACT_NODE_LABEL);
}
-
- @Override
- public void outputUnordered(
- QueryOptions options,
- Iterable<Target> result,
- OutputStream out,
- AspectResolver aspectProvider)
- throws IOException, InterruptedException {
- Preconditions.checkState(options.orderOutput == OrderOutput.NO);
- setOptions(options, aspectResolver);
- OutputFormatterCallback.processAllTargets(
- createPostFactoStreamCallback(out, options), result);
- }
}
/** Abstract class supplying a {@link PrintStream} to implementations, flushing it on close. */
diff --git a/src/main/java/com/google/devtools/build/lib/query2/query/output/QueryOutputUtils.java b/src/main/java/com/google/devtools/build/lib/query2/query/output/QueryOutputUtils.java
index 7cf76d02..cba93a7 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/query/output/QueryOutputUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/query/output/QueryOutputUtils.java
@@ -52,7 +52,7 @@
OutputFormatterCallback.processAllTargets(
streamedFormatter.createPostFactoStreamCallback(outputStream, queryOptions),
targetsResult);
- } else if (result instanceof DigraphQueryEvalResult) {
+ } else {
@SuppressWarnings("unchecked")
DigraphQueryEvalResult<Target> digraphQueryEvalResult =
(DigraphQueryEvalResult<Target>) result;
@@ -77,14 +77,6 @@
try (SilentCloseable closeable = Profiler.instance().profile("formatter.output")) {
formatter.output(queryOptions, subgraph, outputStream, aspectResolver, conditionalEdges);
}
- } else {
- if (formatter instanceof GraphOutputFormatter) {
- throw new IllegalStateException();
- }
-
- try (SilentCloseable closeable = Profiler.instance().profile("formatter.outputUnordered")) {
- formatter.outputUnordered(queryOptions, targetsResult, outputStream, aspectResolver);
- }
}
}
}