Search in sources :

Example 11 with AttributeMap

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

the class ResourceDependencies method extractFromAttributes.

private static void extractFromAttributes(Iterable<String> attributeNames, RuleContext ruleContext, NestedSetBuilder<ResourceContainer> builderForTransitive, NestedSetBuilder<ResourceContainer> builderForDirect) {
    AttributeMap attributes = ruleContext.attributes();
    for (String attr : attributeNames) {
        if (!attributes.has(attr, BuildType.LABEL_LIST) && !attributes.has(attr, BuildType.LABEL)) {
            continue;
        }
        for (AndroidResourcesProvider resources : ruleContext.getPrerequisites(attr, Mode.TARGET, AndroidResourcesProvider.class)) {
            builderForTransitive.addTransitive(resources.getTransitiveAndroidResources());
            builderForDirect.addTransitive(resources.getDirectAndroidResources());
        }
    }
}
Also used : AttributeMap(com.google.devtools.build.lib.packages.AttributeMap)

Aggregations

AttributeMap (com.google.devtools.build.lib.packages.AttributeMap)11 Attribute (com.google.devtools.build.lib.packages.Attribute)5 Rule (com.google.devtools.build.lib.packages.Rule)5 Test (org.junit.Test)3 Label (com.google.devtools.build.lib.cmdline.Label)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 OutputFileConfiguredTarget (com.google.devtools.build.lib.analysis.OutputFileConfiguredTarget)1 TransitiveInfoCollection (com.google.devtools.build.lib.analysis.TransitiveInfoCollection)1 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)1 LabelSyntaxException (com.google.devtools.build.lib.cmdline.LabelSyntaxException)1 RepositoryName (com.google.devtools.build.lib.cmdline.RepositoryName)1 IterablesChain (com.google.devtools.build.lib.collect.IterablesChain)1 Location (com.google.devtools.build.lib.events.Location)1 AspectDefinition (com.google.devtools.build.lib.packages.AspectDefinition)1 LateBoundLabel (com.google.devtools.build.lib.packages.Attribute.LateBoundLabel)1 License (com.google.devtools.build.lib.packages.License)1 Target (com.google.devtools.build.lib.packages.Target)1 DefaultModelResolver (com.google.devtools.build.workspace.maven.DefaultModelResolver)1 InvalidArtifactCoordinateException (com.google.devtools.build.workspace.maven.Resolver.InvalidArtifactCoordinateException)1 Rule (com.google.devtools.build.workspace.maven.Rule)1