Search in sources :

Example 21 with AspectDescriptor

use of com.google.devtools.build.lib.packages.AspectDescriptor in project bazel by bazelbuild.

the class AspectCollectionTest method validateAspectPaths.

private static void validateAspectPaths(AspectCollection collection, ImmutableList<Pair<Aspect, ImmutableList<Aspect>>> expectedList) {
    HashMap<AspectDescriptor, AspectDeps> allPaths = new HashMap<>();
    for (AspectDeps aspectPath : collection.getVisibleAspects()) {
        collectAndValidateAspectDeps(aspectPath, allPaths);
    }
    HashSet<AspectDescriptor> expectedKeys = new HashSet<>();
    for (Pair<Aspect, ImmutableList<Aspect>> expected : expectedList) {
        assertThat(allPaths).containsKey(expected.first.getDescriptor());
        AspectDeps aspectPath = allPaths.get(expected.first.getDescriptor());
        assertThat(Iterables.transform(aspectPath.getDependentAspects(), ASPECT_PATH_TO_DESCRIPTOR)).containsExactlyElementsIn(Iterables.transform(expected.second, ASPECT_TO_DESCRIPTOR)).inOrder();
        expectedKeys.add(expected.first.getDescriptor());
    }
    assertThat(allPaths.keySet()).containsExactlyElementsIn(expectedKeys);
}
Also used : AspectDeps(com.google.devtools.build.lib.analysis.AspectCollection.AspectDeps) HashMap(java.util.HashMap) ImmutableList(com.google.common.collect.ImmutableList) AspectDescriptor(com.google.devtools.build.lib.packages.AspectDescriptor) Aspect(com.google.devtools.build.lib.packages.Aspect) HashSet(java.util.HashSet)

Aggregations

AspectDescriptor (com.google.devtools.build.lib.packages.AspectDescriptor)21 Test (org.junit.Test)8 Aspect (com.google.devtools.build.lib.packages.Aspect)5 Attribute (com.google.devtools.build.lib.packages.Attribute)5 SkyKey (com.google.devtools.build.skyframe.SkyKey)5 ImmutableList (com.google.common.collect.ImmutableList)4 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)4 AspectDeps (com.google.devtools.build.lib.analysis.AspectCollection.AspectDeps)3 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)3 MergedConfiguredTarget (com.google.devtools.build.lib.analysis.MergedConfiguredTarget)3 TestAspects (com.google.devtools.build.lib.analysis.util.TestAspects)3 Label (com.google.devtools.build.lib.cmdline.Label)3 Rule (com.google.devtools.build.lib.packages.Rule)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 ConfiguredAspect (com.google.devtools.build.lib.analysis.ConfiguredAspect)2 Dependency (com.google.devtools.build.lib.analysis.Dependency)2 DuplicateException (com.google.devtools.build.lib.analysis.MergedConfiguredTarget.DuplicateException)2