Start separating dependency resolution into two parts:
- A part that depends on the rule where the edge originates from
- A part that depends on the target the edge points to
The separation is still not perfect: aspect calculations require knowledge of the attribute and error reporting requires knowledge of the location of the originating rule.
Both of these issues can be fixed, but let's take small steps. It's a complex area.
RELNOTES: None.
PiperOrigin-RevId: 232438428
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AspectDefinitionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AspectDefinitionTest.java
index b2ab9aa..3e81a2a 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/AspectDefinitionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/AspectDefinitionTest.java
@@ -126,10 +126,8 @@
.propagateAlongAttribute("deps")
.build();
- assertThat(withAspects.propagateAlong(createLabelListAttribute("srcs")))
- .isTrue();
- assertThat(withAspects.propagateAlong(createLabelListAttribute("deps")))
- .isTrue();
+ assertThat(withAspects.propagateAlong("srcs")).isTrue();
+ assertThat(withAspects.propagateAlong("deps")).isTrue();
}
@Test
@@ -138,17 +136,8 @@
.propagateAlongAllAttributes()
.build();
- assertThat(withAspects.propagateAlong(createLabelListAttribute("srcs")))
- .isTrue();
- assertThat(withAspects.propagateAlong(createLabelListAttribute("deps")))
- .isTrue();
- }
-
-
- private static Attribute createLabelListAttribute(String name) {
- return Attribute.attr(name, BuildType.LABEL_LIST)
- .allowedFileTypes(FileTypeSet.ANY_FILE)
- .build();
+ assertThat(withAspects.propagateAlong("srcs")).isTrue();
+ assertThat(withAspects.propagateAlong("deps")).isTrue();
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
index da18bec..d509ad7 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
@@ -1433,9 +1433,7 @@
"my_aspect = aspect(_impl, attr_aspects=['*'])");
SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect");
- assertThat(myAspect.getDefinition(AspectParameters.EMPTY).propagateAlong(
- Attribute.attr("foo", BuildType.LABEL).allowedFileTypes().build()
- )).isTrue();
+ assertThat(myAspect.getDefinition(AspectParameters.EMPTY).propagateAlong("foo")).isTrue();
}
@Test