use of com.google.devtools.build.lib.analysis.util.TestAspects.AttributeAspect in project bazel by bazelbuild.
the class AspectValueTest method keyEquality.
@Test
public void keyEquality() throws Exception {
update();
BuildConfiguration c1 = getTargetConfiguration();
BuildConfiguration c2 = getHostConfiguration();
Label l1 = Label.parseAbsolute("//a:l1");
Label l1b = Label.parseAbsolute("//a:l1");
Label l2 = Label.parseAbsolute("//a:l2");
AspectParameters i1 = new AspectParameters.Builder().addAttribute("foo", "bar").build();
AspectParameters i1b = new AspectParameters.Builder().addAttribute("foo", "bar").build();
AspectParameters i2 = new AspectParameters.Builder().addAttribute("foo", "baz").build();
AttributeAspect a1 = TestAspects.ATTRIBUTE_ASPECT;
AttributeAspect a1b = TestAspects.ATTRIBUTE_ASPECT;
ExtraAttributeAspect a2 = TestAspects.EXTRA_ATTRIBUTE_ASPECT;
// label: //a:l1 or //a:l2
// aspectConfiguration: target or host
// baseConfiguration: target or host
// aspect: Attribute or ExtraAttribute
// parameters: bar or baz
new EqualsTester().addEqualityGroup(createKey(l1, c1, a1, i1, c1), createKey(l1, c1, a1, i1b, c1), createKey(l1, c1, a1b, i1, c1), createKey(l1, c1, a1b, i1b, c1), createKey(l1b, c1, a1, i1, c1), createKey(l1b, c1, a1, i1b, c1), createKey(l1b, c1, a1b, i1, c1), createKey(l1b, c1, a1b, i1b, c1)).addEqualityGroup(createKey(l1, c1, a1, i2, c1), createKey(l1, c1, a1b, i2, c1), createKey(l1b, c1, a1, i2, c1), createKey(l1b, c1, a1b, i2, c1)).addEqualityGroup(createKey(l1, c1, a2, i1, c1), createKey(l1, c1, a2, i1b, c1), createKey(l1b, c1, a2, i1, c1), createKey(l1b, c1, a2, i1b, c1)).addEqualityGroup(createKey(l1, c1, a2, i2, c1), createKey(l1b, c1, a2, i2, c1)).addEqualityGroup(createKey(l1, c2, a1, i1, c1), createKey(l1, c2, a1, i1b, c1), createKey(l1, c2, a1b, i1, c1), createKey(l1, c2, a1b, i1b, c1), createKey(l1b, c2, a1, i1, c1), createKey(l1b, c2, a1, i1b, c1), createKey(l1b, c2, a1b, i1, c1), createKey(l1b, c2, a1b, i1b, c1)).addEqualityGroup(createKey(l1, c2, a1, i2, c1), createKey(l1, c2, a1b, i2, c1), createKey(l1b, c2, a1, i2, c1), createKey(l1b, c2, a1b, i2, c1)).addEqualityGroup(createKey(l1, c2, a2, i1, c1), createKey(l1, c2, a2, i1b, c1), createKey(l1b, c2, a2, i1, c1), createKey(l1b, c2, a2, i1b, c1)).addEqualityGroup(createKey(l1, c2, a2, i2, c1), createKey(l1b, c2, a2, i2, c1)).addEqualityGroup(createKey(l1, c1, a1, i1, c2), createKey(l1, c1, a1, i1b, c2), createKey(l1, c1, a1b, i1, c2), createKey(l1, c1, a1b, i1b, c2), createKey(l1b, c1, a1, i1, c2), createKey(l1b, c1, a1, i1b, c2), createKey(l1b, c1, a1b, i1, c2), createKey(l1b, c1, a1b, i1b, c2)).addEqualityGroup(createKey(l1, c1, a1, i2, c2), createKey(l1, c1, a1b, i2, c2), createKey(l1b, c1, a1, i2, c2), createKey(l1b, c1, a1b, i2, c2)).addEqualityGroup(createKey(l1, c1, a2, i1, c2), createKey(l1, c1, a2, i1b, c2), createKey(l1b, c1, a2, i1, c2), createKey(l1b, c1, a2, i1b, c2)).addEqualityGroup(createKey(l1, c1, a2, i2, c2), createKey(l1b, c1, a2, i2, c2)).addEqualityGroup(createKey(l1, c2, a1, i1, c2), createKey(l1, c2, a1, i1b, c2), createKey(l1, c2, a1b, i1, c2), createKey(l1, c2, a1b, i1b, c2), createKey(l1b, c2, a1, i1, c2), createKey(l1b, c2, a1, i1b, c2), createKey(l1b, c2, a1b, i1, c2), createKey(l1b, c2, a1b, i1b, c2)).addEqualityGroup(createKey(l1, c2, a1, i2, c2), createKey(l1, c2, a1b, i2, c2), createKey(l1b, c2, a1, i2, c2), createKey(l1b, c2, a1b, i2, c2)).addEqualityGroup(createKey(l1, c2, a2, i1, c2), createKey(l1, c2, a2, i1b, c2), createKey(l1b, c2, a2, i1, c2), createKey(l1b, c2, a2, i1b, c2)).addEqualityGroup(createKey(l1, c2, a2, i2, c2), createKey(l1b, c2, a2, i2, c2)).addEqualityGroup(createKey(l2, c1, a1, i1, c1), createKey(l2, c1, a1, i1b, c1), createKey(l2, c1, a1b, i1, c1), createKey(l2, c1, a1b, i1b, c1)).addEqualityGroup(createKey(l2, c1, a1, i2, c1), createKey(l2, c1, a1b, i2, c1)).addEqualityGroup(createKey(l2, c1, a2, i1, c1), createKey(l2, c1, a2, i1b, c1)).addEqualityGroup(createKey(l2, c1, a2, i2, c1)).addEqualityGroup(createKey(l2, c2, a1, i1, c1), createKey(l2, c2, a1, i1b, c1), createKey(l2, c2, a1b, i1, c1), createKey(l2, c2, a1b, i1b, c1)).addEqualityGroup(createKey(l2, c2, a1, i2, c1), createKey(l2, c2, a1b, i2, c1)).addEqualityGroup(createKey(l2, c2, a2, i1, c1), createKey(l2, c2, a2, i1b, c1)).addEqualityGroup(createKey(l2, c2, a2, i2, c1)).addEqualityGroup(createKey(l2, c1, a1, i1, c2), createKey(l2, c1, a1, i1b, c2), createKey(l2, c1, a1b, i1, c2), createKey(l2, c1, a1b, i1b, c2)).addEqualityGroup(createKey(l2, c1, a1, i2, c2), createKey(l2, c1, a1b, i2, c2)).addEqualityGroup(createKey(l2, c1, a2, i1, c2), createKey(l2, c1, a2, i1b, c2)).addEqualityGroup(createKey(l2, c1, a2, i2, c2)).addEqualityGroup(createKey(l2, c2, a1, i1, c2), createKey(l2, c2, a1, i1b, c2), createKey(l2, c2, a1b, i1, c2), createKey(l2, c2, a1b, i1b, c2)).addEqualityGroup(createKey(l2, c2, a1, i2, c2), createKey(l2, c2, a1b, i2, c2)).addEqualityGroup(createKey(l2, c2, a2, i1, c2), createKey(l2, c2, a2, i1b, c2)).addEqualityGroup(createKey(l2, c2, a2, i2, c2)).addEqualityGroup(createDerivedKey(l1, c1, a1, i1, c1, a2, i2, c2), createDerivedKey(l1, c1, a1, i1b, c1, a2, i2, c2)).addEqualityGroup(createDerivedKey(l1, c1, a2, i1, c1, a1, i2, c2), createDerivedKey(l1, c1, a2, i1b, c1, a1, i2, c2)).testEquals();
}
Aggregations