Search in sources :

Example 16 with SkylarkAspect

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

the class SkylarkRuleClassFunctionsTest method aspectAllAttrs.

@Test
public void aspectAllAttrs() throws Exception {
    evalAndExport("def _impl(target, ctx):", "   pass", "my_aspect = aspect(_impl, attr_aspects=['*'])");
    SkylarkAspect myAspect = (SkylarkAspect) lookup("my_aspect");
    assertThat(myAspect.getDefinition(AspectParameters.EMPTY).propagateAlong(Attribute.attr("foo", BuildType.LABEL).allowedFileTypes().build())).isTrue();
}
Also used : SkylarkAspect(com.google.devtools.build.lib.packages.SkylarkAspect) Test(org.junit.Test)

Aggregations

SkylarkAspect (com.google.devtools.build.lib.packages.SkylarkAspect)16 Test (org.junit.Test)12 Attribute (com.google.devtools.build.lib.packages.Attribute)4 RequiredProviders (com.google.devtools.build.lib.packages.RequiredProviders)4 SkyKey (com.google.devtools.build.skyframe.SkyKey)3 Nullable (javax.annotation.Nullable)3 Label (com.google.devtools.build.lib.cmdline.Label)2 AspectDescriptor (com.google.devtools.build.lib.packages.AspectDescriptor)2 SkylarkAspectClass (com.google.devtools.build.lib.packages.SkylarkAspectClass)2 SkylarkAttr (com.google.devtools.build.lib.rules.SkylarkAttr)2 Descriptor (com.google.devtools.build.lib.rules.SkylarkAttr.Descriptor)2 SkylarkImportFailedException (com.google.devtools.build.lib.skyframe.SkylarkImportLookupFunction.SkylarkImportFailedException)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ConfiguredAspect (com.google.devtools.build.lib.analysis.ConfiguredAspect)1 ConfiguredAspectFactory (com.google.devtools.build.lib.analysis.ConfiguredAspectFactory)1 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)1 InconsistentAspectOrderException (com.google.devtools.build.lib.analysis.DependencyResolver.InconsistentAspectOrderException)1 MergedConfiguredTarget (com.google.devtools.build.lib.analysis.MergedConfiguredTarget)1 DuplicateException (com.google.devtools.build.lib.analysis.MergedConfiguredTarget.DuplicateException)1