A prototype implementation of top-level aspects.
--
MOS_MIGRATED_REVID=101033236
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
index 30358ac..7db3e46 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
@@ -80,9 +80,14 @@
"aspects must be attached to rules"));
}
- RuleConfiguredTarget associatedTarget = (RuleConfiguredTarget)
- ((ConfiguredTargetValue) env.getValue(ConfiguredTargetValue.key(
- key.getLabel(), key.getConfiguration()))).getConfiguredTarget();
+ final ConfiguredTargetValue configuredTargetValue =
+ (ConfiguredTargetValue)
+ env.getValue(ConfiguredTargetValue.key(key.getLabel(), key.getConfiguration()));
+ if (configuredTargetValue == null) {
+ return null;
+ }
+ RuleConfiguredTarget associatedTarget =
+ (RuleConfiguredTarget) configuredTargetValue.getConfiguredTarget();
if (associatedTarget == null) {
return null;
@@ -152,7 +157,11 @@
Preconditions.checkNotNull(aspect);
return new AspectValue(
- aspect, ImmutableList.copyOf(analysisEnvironment.getRegisteredActions()));
+ key,
+ associatedTarget.getLabel(),
+ associatedTarget.getTarget().getLocation(),
+ aspect,
+ ImmutableList.copyOf(analysisEnvironment.getRegisteredActions()));
}
@Nullable