Search in sources :

Example 6 with AggregatingAttributeMapper

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

the class AggregatingAttributeMapperTest method testGetReachableLabelsWithDefaultValues.

@Test
public void testGetReachableLabelsWithDefaultValues() throws Exception {
    Rule rule = scratchRule("a", "myrule", "cc_binary(name = 'myrule',", "    srcs = [],", "    malloc = select({", "        '//conditions:a': None,", "    }))");
    AggregatingAttributeMapper mapper = AggregatingAttributeMapper.of(rule);
    assertThat(mapper.getReachableLabels("malloc", true)).containsExactly(getDefaultMallocLabel(rule), Label.create("@//conditions", "a"));
}
Also used : Rule(com.google.devtools.build.lib.packages.Rule) AggregatingAttributeMapper(com.google.devtools.build.lib.packages.AggregatingAttributeMapper) Test(org.junit.Test)

Aggregations

AggregatingAttributeMapper (com.google.devtools.build.lib.packages.AggregatingAttributeMapper)6 Rule (com.google.devtools.build.lib.packages.Rule)5 Test (org.junit.Test)3 Label (com.google.devtools.build.lib.cmdline.Label)2 LabelSyntaxException (com.google.devtools.build.lib.cmdline.LabelSyntaxException)1 Attribute (com.google.devtools.build.lib.packages.Attribute)1 BuildFileNotFoundException (com.google.devtools.build.lib.packages.BuildFileNotFoundException)1 ErrorDeterminingRepositoryException (com.google.devtools.build.lib.packages.ErrorDeterminingRepositoryException)1 Package (com.google.devtools.build.lib.packages.Package)1 NameConflictException (com.google.devtools.build.lib.packages.Package.NameConflictException)1 Target (com.google.devtools.build.lib.packages.Target)1 TargetNotFoundException (com.google.devtools.build.lib.query2.engine.QueryEnvironment.TargetNotFoundException)1 LocalRepositoryRule (com.google.devtools.build.lib.rules.repository.LocalRepositoryRule)1 PackageFunctionException (com.google.devtools.build.lib.skyframe.PackageFunction.PackageFunctionException)1 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)1 RootedPath (com.google.devtools.build.lib.vfs.RootedPath)1 SkyKey (com.google.devtools.build.skyframe.SkyKey)1 ArrayList (java.util.ArrayList)1