Use the correct Aspect in AspectFunction for Skylark aspects.
Previously AspectFunction was using an Aspect from the SkyKey, which
might have been stale.
This CL fixes the bug as uncovered in the test (see SkylarkAspectsTest),
but further refactoring is needed since SkylarkAspectClass equals() is
incorrect, and in fact obtaining the Skylark aspect definition should
always introduce Skyframe dependency.
--
MOS_MIGRATED_REVID=119137636
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java
index 43bc287..83a8a71 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java
@@ -85,10 +85,6 @@
return aspect.getParameters();
}
- public Aspect getAspect() {
- return aspect;
- }
-
@Override
public String getDescription() {
return String.format("%s of %s", aspect.getAspectClass().getName(), getLabel());
@@ -231,6 +227,7 @@
private final Label label;
+ private final Aspect aspect;
private final Location location;
private final AspectKey key;
private final ConfiguredAspect configuredAspect;
@@ -238,12 +235,14 @@
public AspectValue(
AspectKey key,
+ Aspect aspect,
Label label,
Location location,
ConfiguredAspect configuredAspect,
Iterable<Action> actions,
NestedSet<Package> transitivePackages) {
super(actions);
+ this.aspect = aspect;
this.location = location;
this.label = label;
this.key = key;
@@ -267,6 +266,10 @@
return key;
}
+ public Aspect getAspect() {
+ return aspect;
+ }
+
public NestedSet<Package> getTransitivePackages() {
return transitivePackages;
}