Add aquery as proper command to Bazel.
RELNOTES: Add aquery command to get analysis time information about the action graph.
PiperOrigin-RevId: 205064145
diff --git a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
index df61da8..fb17eac 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
@@ -341,19 +341,24 @@
.collect(Collectors.toList());
}
}
- if (settings.contains(Setting.NO_IMPLICIT_DEPS) && target instanceof RuleConfiguredTarget) {
- Set<ConfiguredTargetKey> implicitDeps = ((RuleConfiguredTarget) target).getImplicitDeps();
- deps =
- deps.stream()
- .filter(
- dep ->
- !implicitDeps.contains(
- ConfiguredTargetKey.of(getCorrectLabel(dep), getConfiguration(dep))))
- .collect(Collectors.toList());
+ if (settings.contains(Setting.NO_IMPLICIT_DEPS)) {
+ RuleConfiguredTarget ruleConfiguredTarget = getRuleConfiguredTarget(target);
+ if (ruleConfiguredTarget != null) {
+ Set<ConfiguredTargetKey> implicitDeps = ruleConfiguredTarget.getImplicitDeps();
+ deps =
+ deps.stream()
+ .filter(
+ dep ->
+ !implicitDeps.contains(
+ ConfiguredTargetKey.of(getCorrectLabel(dep), getConfiguration(dep))))
+ .collect(Collectors.toList());
+ }
}
return deps;
}
+ protected abstract RuleConfiguredTarget getRuleConfiguredTarget(T target);
+
protected Map<SkyKey, Collection<T>> targetifyValues(
Map<SkyKey, ? extends Iterable<SkyKey>> input) throws InterruptedException {
Map<SkyKey, Collection<T>> result = new HashMap<>();