For --aspects parameter, ignore top-level targets that are not rules.
--
MOS_MIGRATED_REVID=126161513
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
index 7b42b37..2f5f70f 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
@@ -449,7 +449,10 @@
PathFragment bzlFile = new PathFragment("/" + aspect.substring(0, delimiterPosition));
String skylarkFunctionName = aspect.substring(delimiterPosition + 1);
- for (ConfiguredTargetKey targetSpec : topLevelCtKeys) {
+ for (TargetAndConfiguration targetSpec : topLevelTargetsWithConfigs) {
+ if (!(targetSpec.getTarget() instanceof Rule)) {
+ continue;
+ }
aspectKeys.add(
AspectValue.createSkylarkAspectKey(
targetSpec.getLabel(),
@@ -464,7 +467,10 @@
final NativeAspectClass aspectFactoryClass =
ruleClassProvider.getNativeAspectClassMap().get(aspect);
if (aspectFactoryClass != null) {
- for (ConfiguredTargetKey targetSpec : topLevelCtKeys) {
+ for (TargetAndConfiguration targetSpec : topLevelTargetsWithConfigs) {
+ if (!(targetSpec.getTarget() instanceof Rule)) {
+ continue;
+ }
aspectKeys.add(
AspectValue.createAspectKey(
targetSpec.getLabel(),