aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/AllPathsFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/AllRdepsFunction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/BinaryOperatorExpression.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/BuildFilesFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/DepsFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/FunctionExpression.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/LabelsFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/LetExpression.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/QueryExpression.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/RdepsFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/RegexFilterExpression.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/SomeFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/SomePathFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java2
21 files changed, 32 insertions, 37 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java b/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java
index 42280e3490..a9dccefcbe 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java
@@ -119,7 +119,7 @@ public final class FetchCommand implements BlazeCommand {
// 2. Evaluate expression:
try {
env.evaluateQuery(expr);
- } catch (QueryException e) {
+ } catch (QueryException | InterruptedException e) {
// Keep consistent with reportBuildFileError()
runtime.getReporter().handle(Event.error(e.getMessage()));
return ExitCode.COMMAND_LINE_ERROR;
diff --git a/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java
index 95a86ef0ea..27b0838d1a 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java
@@ -131,7 +131,8 @@ public abstract class AbstractBlazeQueryEnvironment<T> implements QueryEnvironme
* @throws QueryException if the evaluation failed and {@code --nokeep_going} was in
* effect
*/
- public QueryEvalResult<T> evaluateQuery(QueryExpression expr) throws QueryException {
+ public QueryEvalResult<T> evaluateQuery(QueryExpression expr)
+ throws QueryException, InterruptedException {
resolvedTargetPatterns.clear();
// In the --nokeep_going case, errors are reported in the order in which the patterns are
@@ -167,7 +168,8 @@ public abstract class AbstractBlazeQueryEnvironment<T> implements QueryEnvironme
return new QueryEvalResult<>(!eventHandler.hasErrors(), resultNodes);
}
- public QueryEvalResult<T> evaluateQuery(String query) throws QueryException {
+ public QueryEvalResult<T> evaluateQuery(String query)
+ throws QueryException, InterruptedException {
return evaluateQuery(QueryExpression.parse(query, this));
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
index a5c6d1da1a..db9d637257 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
@@ -95,7 +95,8 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
}
@Override
- public BlazeQueryEvalResult<Target> evaluateQuery(QueryExpression expr) throws QueryException {
+ public BlazeQueryEvalResult<Target> evaluateQuery(QueryExpression expr)
+ throws QueryException, InterruptedException {
// Some errors are reported as QueryExceptions and others as ERROR events (if --keep_going). The
// result is set to have an error iff there were errors emitted during the query, so we reset
// errors here.
@@ -241,16 +242,11 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
@Override
public void buildTransitiveClosure(QueryExpression caller,
Set<Target> targetNodes,
- int maxDepth) throws QueryException {
+ int maxDepth) throws QueryException, InterruptedException {
Set<Target> targets = targetNodes;
preloadTransitiveClosure(targets, maxDepth);
-
- try {
- labelVisitor.syncWithVisitor(eventHandler, targets, keepGoing,
- loadingPhaseThreads, maxDepth, errorObserver, new GraphBuildingObserver());
- } catch (InterruptedException e) {
- throw new QueryException(caller, "transitive closure computation was interrupted");
- }
+ labelVisitor.syncWithVisitor(eventHandler, targets, keepGoing,
+ loadingPhaseThreads, maxDepth, errorObserver, new GraphBuildingObserver());
if (errorObserver.hasErrors()) {
reportBuildFileError(caller, "errors were encountered while computing transitive closure");
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
index d98b93314b..cb0f2f69e9 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
@@ -138,16 +138,12 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> {
@Override
public QueryEvalResult<Target> evaluateQuery(QueryExpression expr)
- throws QueryException {
+ throws QueryException, InterruptedException {
// Some errors are reported as QueryExceptions and others as ERROR events (if --keep_going). The
// result is set to have an error iff there were errors emitted during the query, so we reset
// errors here.
eventHandler.resetErrors();
- try {
- init();
- } catch (InterruptedException e) {
- throw new QueryException(e.getMessage());
- }
+ init();
return super.evaluateQuery(expr);
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/AllPathsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/AllPathsFunction.java
index 4920298bfb..ca307a8ff4 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/AllPathsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/AllPathsFunction.java
@@ -49,7 +49,7 @@ public class AllPathsFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
QueryExpression from = args.get(0).getExpression();
QueryExpression to = args.get(1).getExpression();
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/AllRdepsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/AllRdepsFunction.java
index 5f1493e54b..ac2352573c 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/AllRdepsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/AllRdepsFunction.java
@@ -59,7 +59,7 @@ public class AllRdepsFunction implements QueryFunction {
* predicate.
*/
protected <T> Set<T> eval(QueryEnvironment<T> env, List<Argument> args, Predicate<T> universe)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> argumentValue = args.get(0).getExpression().eval(env);
int depthBound = args.size() > 1 ? args.get(1).getInteger() : Integer.MAX_VALUE;
Set<T> visited = new LinkedHashSet<>();
@@ -90,7 +90,7 @@ public class AllRdepsFunction implements QueryFunction {
/** Breadth-first search from the argument. */
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
return eval(env, args, Predicates.<T>alwaysTrue());
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/BinaryOperatorExpression.java b/src/main/java/com/google/devtools/build/lib/query2/engine/BinaryOperatorExpression.java
index e5e600f831..2a5cdd8bb7 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/BinaryOperatorExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/BinaryOperatorExpression.java
@@ -46,7 +46,7 @@ class BinaryOperatorExpression extends QueryExpression {
}
@Override
- public <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException {
+ public <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException, InterruptedException {
Set<T> lhsValue = new LinkedHashSet<>(operands.get(0).eval(env));
for (int i = 1; i < operands.size(); i++) {
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/BuildFilesFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/BuildFilesFunction.java
index d606a6acb3..89c4d34c0c 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/BuildFilesFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/BuildFilesFunction.java
@@ -40,7 +40,7 @@ class BuildFilesFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
return env.getBuildFiles(expression, args.get(0).getExpression().eval(env));
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/DepsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/DepsFunction.java
index 25b1da7944..2a7dc60782 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/DepsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/DepsFunction.java
@@ -57,7 +57,7 @@ final class DepsFunction implements QueryFunction {
*/
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> argumentValue = args.get(0).getExpression().eval(env);
int depthBound = args.size() > 1 ? args.get(1).getInteger() : Integer.MAX_VALUE;
env.buildTransitiveClosure(expression, argumentValue, depthBound);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/FunctionExpression.java b/src/main/java/com/google/devtools/build/lib/query2/engine/FunctionExpression.java
index 62734fd07e..b601abb932 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/FunctionExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/FunctionExpression.java
@@ -38,7 +38,7 @@ public class FunctionExpression extends QueryExpression {
}
@Override
- public <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException {
+ public <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException, InterruptedException {
return function.<T>eval(env, this, args);
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/LabelsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/LabelsFunction.java
index 1093d85290..e1ad537046 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/LabelsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/LabelsFunction.java
@@ -54,7 +54,7 @@ class LabelsFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> inputs = args.get(1).getExpression().eval(env);
Set<T> result = new LinkedHashSet<>();
String attrName = args.get(0).getWord();
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/LetExpression.java b/src/main/java/com/google/devtools/build/lib/query2/engine/LetExpression.java
index 3e17ccebbe..cc4ec5c5bb 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/LetExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/LetExpression.java
@@ -52,7 +52,7 @@ class LetExpression extends QueryExpression {
}
@Override
- public <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException {
+ public <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException, InterruptedException {
if (!NAME_PATTERN.matcher(varName).matches()) {
throw new QueryException(this, "invalid variable name '" + varName + "' in let expression");
}
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java
index 78812cc11a..6dfabfd818 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/QueryEnvironment.java
@@ -123,7 +123,7 @@ public interface QueryEnvironment<T> {
* by {@link #getArgumentTypes} and {@link #getMandatoryArguments}
*/
<T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException;
+ throws QueryException, InterruptedException;
}
/**
@@ -176,7 +176,7 @@ public interface QueryEnvironment<T> {
*/
void buildTransitiveClosure(QueryExpression caller,
Set<T> targetNodes,
- int maxDepth) throws QueryException;
+ int maxDepth) throws QueryException, InterruptedException;
/**
* Returns the set of nodes on some path from "from" to "to".
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/QueryExpression.java b/src/main/java/com/google/devtools/build/lib/query2/engine/QueryExpression.java
index 23603f16ff..3e71aac64a 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/QueryExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/QueryExpression.java
@@ -67,7 +67,8 @@ public abstract class QueryExpression {
* thrown. If disabled, evaluation will stumble on to produce a (possibly
* inaccurate) result, but a result nonetheless.
*/
- public abstract <T> Set<T> eval(QueryEnvironment<T> env) throws QueryException;
+ public abstract <T> Set<T> eval(QueryEnvironment<T> env)
+ throws QueryException, InterruptedException;
/**
* Collects all target patterns that are referenced anywhere within this query expression and adds
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/RdepsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/RdepsFunction.java
index 68d0d8b7b2..2f206ce152 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/RdepsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/RdepsFunction.java
@@ -54,7 +54,7 @@ final class RdepsFunction extends AllRdepsFunction {
*/
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> universeValue = args.get(0).getExpression().eval(env);
env.buildTransitiveClosure(expression, universeValue, Integer.MAX_VALUE);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/RegexFilterExpression.java b/src/main/java/com/google/devtools/build/lib/query2/engine/RegexFilterExpression.java
index 1dbe5e63d3..bce25c5cc7 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/RegexFilterExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/RegexFilterExpression.java
@@ -32,7 +32,7 @@ abstract class RegexFilterExpression implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Pattern compiledPattern;
try {
compiledPattern = Pattern.compile(getPattern(args));
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/SomeFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/SomeFunction.java
index 384b4740ad..417192470c 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/SomeFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/SomeFunction.java
@@ -49,7 +49,7 @@ class SomeFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> argumentValue = args.get(0).getExpression().eval(env);
if (argumentValue.isEmpty()) {
throw new QueryException(expression, "argument set is empty");
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/SomePathFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/SomePathFunction.java
index b90bcdfde9..820f0f1619 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/SomePathFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/SomePathFunction.java
@@ -52,7 +52,7 @@ class SomePathFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> fromValue = args.get(0).getExpression().eval(env);
Set<T> toValue = args.get(1).getExpression().eval(env);
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java
index c902609b9f..72499504f8 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/TestsFunction.java
@@ -63,7 +63,7 @@ class TestsFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Closure<T> closure = new Closure<>(expression, env);
Set<T> result = new HashSet<>();
for (T target : args.get(0).getExpression().eval(env)) {
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java b/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java
index f268116805..8ce8aa5ab4 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/VisibleFunction.java
@@ -54,7 +54,7 @@ public class VisibleFunction implements QueryFunction {
@Override
public <T> Set<T> eval(QueryEnvironment<T> env, QueryExpression expression, List<Argument> args)
- throws QueryException {
+ throws QueryException, InterruptedException {
Set<T> toSet = args.get(0).getExpression().eval(env);
Set<T> targets = args.get(1).getExpression().eval(env);
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
index 72ec9ad8f7..2792a15b66 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
@@ -126,7 +126,7 @@ public final class QueryCommand implements BlazeCommand {
QueryEvalResult<Target> result;
try {
result = env.evaluateQuery(expr);
- } catch (QueryException e) {
+ } catch (QueryException | InterruptedException e) {
// Keep consistent with reportBuildFileError()
runtime.getReporter().handle(Event.error(e.getMessage()));
return ExitCode.ANALYSIS_FAILURE;