aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/genquery
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-06-16 21:14:10 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-06-19 18:23:44 +0200
commit9e26369575f04776c0416fd75a9434a22b4d5e9a (patch)
tree6e7cb5b75d5d766586a3e9bf51bb5affee8e9e7d /src/main/java/com/google/devtools/build/lib/rules/genquery
parentb1b794ba78d9f1ccfd013fd56c62c737ec14a4d4 (diff)
Ban the combination of buildfiles/loadfiles and --output=location.
RELNOTES[INC]: The --output=location flag to 'bazel query' cannot be used with query expressions that involve the 'buildfiles' or 'loadfiles' operators. This also applies to 'genquery' rules. PiperOrigin-RevId: 159259061
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/genquery')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
index d044aafed3..f5abf25019 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
@@ -55,6 +55,7 @@ import com.google.devtools.build.lib.query2.engine.DigraphQueryEvalResult;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.QueryFunction;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.Setting;
import com.google.devtools.build.lib.query2.engine.QueryException;
+import com.google.devtools.build.lib.query2.engine.QueryExpression;
import com.google.devtools.build.lib.query2.engine.QueryUtil;
import com.google.devtools.build.lib.query2.engine.QueryUtil.AggregateAllOutputFormatterCallback;
import com.google.devtools.build.lib.query2.engine.SkyframeRestartQueryException;
@@ -300,7 +301,7 @@ public class GenQuery implements RuleConfiguredTargetFactory {
ruleContext.getAnalysisEnvironment().getSkyframeEnv());
// This is a precomputed value so it should have been injected by the rules module by the
// time we get there.
- formatter = OutputFormatter.getFormatter(
+ formatter = OutputFormatter.getFormatter(
Preconditions.checkNotNull(outputFormatters), queryOptions.outputFormat);
// All the packages are already loaded at this point, so there is no need
// to start up many threads. 4 are started up to make good use of multiple
@@ -324,7 +325,9 @@ public class GenQuery implements RuleConfiguredTargetFactory {
ImmutableList.<QueryFunction>of(),
/*packagePath=*/ null,
/*blockUniverseEvaluationErrors=*/ false);
- queryResult = (DigraphQueryEvalResult<Target>) queryEnvironment.evaluateQuery(query, targets);
+ QueryExpression expr = QueryExpression.parse(query, queryEnvironment);
+ formatter.verifyCompatible(queryEnvironment, expr);
+ queryResult = queryEnvironment.evaluateQuery(expr, targets);
} catch (SkyframeRestartQueryException e) {
// Do not emit errors for skyframe restarts. They make output of the ConfiguredTargetFunction
// inconsistent from run to run, and make detecting legitimate errors more difficult.