Search in sources :

Example 1 with AspectRequiringRule

use of com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule in project bazel by bazelbuild.

the class AspectTest method testAspectAppliedToChainedAliases.

@Test
public void testAspectAppliedToChainedAliases() throws Exception {
    setRulesAvailableInTests(new TestAspects.BaseRule(), new AspectRequiringRule());
    pkg("a", "aspect(name='a', foo=[':b'])", "alias(name='b', actual=':c')", "alias(name='c', actual=':d')", "alias(name='d', actual=':e')", "base(name='e')");
    ConfiguredTarget a = getConfiguredTarget("//a:a");
    assertThat(a.getProvider(RuleInfo.class).getData()).containsExactly("aspect //a:e", "rule //a:a");
}
Also used : BaseRule(com.google.devtools.build.lib.analysis.util.TestAspects.BaseRule) AspectRequiringRule(com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule) RuleInfo(com.google.devtools.build.lib.analysis.util.TestAspects.RuleInfo) TestAspects(com.google.devtools.build.lib.analysis.util.TestAspects) Test(org.junit.Test)

Example 2 with AspectRequiringRule

use of com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule in project bazel by bazelbuild.

the class AspectTest method providersOfAspectAreMergedIntoDependency.

@Test
public void providersOfAspectAreMergedIntoDependency() throws Exception {
    setRulesAvailableInTests(new TestAspects.BaseRule(), new AspectRequiringRule());
    pkg("a", "aspect(name='a', foo=[':b'])", "aspect(name='b', foo=[])");
    ConfiguredTarget a = getConfiguredTarget("//a:a");
    assertThat(a.getProvider(RuleInfo.class).getData()).containsExactly("aspect //a:b", "rule //a:a");
}
Also used : BaseRule(com.google.devtools.build.lib.analysis.util.TestAspects.BaseRule) AspectRequiringRule(com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule) RuleInfo(com.google.devtools.build.lib.analysis.util.TestAspects.RuleInfo) TestAspects(com.google.devtools.build.lib.analysis.util.TestAspects) Test(org.junit.Test)

Example 3 with AspectRequiringRule

use of com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule in project bazel by bazelbuild.

the class DependencyResolverTest method hasAspectsRequiredByRule.

@Test
public void hasAspectsRequiredByRule() throws Exception {
    setRulesAvailableInTests(new AspectRequiringRule(), new TestAspects.BaseRule());
    pkg("a", "aspect(name='a', foo=[':b'])", "aspect(name='b', foo=[])");
    OrderedSetMultimap<Attribute, Dependency> map = dependentNodeMap("//a:a", null);
    assertDep(map, "foo", "//a:b", new AspectDescriptor(TestAspects.SIMPLE_ASPECT));
}
Also used : Attribute(com.google.devtools.build.lib.packages.Attribute) AspectRequiringRule(com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule) AspectDescriptor(com.google.devtools.build.lib.packages.AspectDescriptor) TestAspects(com.google.devtools.build.lib.analysis.util.TestAspects) Test(org.junit.Test)

Example 4 with AspectRequiringRule

use of com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule in project bazel by bazelbuild.

the class AspectTest method testAspectAppliedToAliasWithSelect.

@Test
public void testAspectAppliedToAliasWithSelect() throws Exception {
    setRulesAvailableInTests(new TestAspects.BaseRule(), new AspectRequiringRule());
    pkg("a", "aspect(name='a', foo=[':b'])", "alias(name='b', actual=select({'//conditions:default': ':c'}))", "base(name='c')");
    ConfiguredTarget a = getConfiguredTarget("//a:a");
    assertThat(a.getProvider(RuleInfo.class).getData()).containsExactly("aspect //a:c", "rule //a:a");
}
Also used : BaseRule(com.google.devtools.build.lib.analysis.util.TestAspects.BaseRule) AspectRequiringRule(com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule) RuleInfo(com.google.devtools.build.lib.analysis.util.TestAspects.RuleInfo) TestAspects(com.google.devtools.build.lib.analysis.util.TestAspects) Test(org.junit.Test)

Example 5 with AspectRequiringRule

use of com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule in project bazel by bazelbuild.

the class AspectTest method testAspectAppliedToChainedAliasesAndSelect.

@Test
public void testAspectAppliedToChainedAliasesAndSelect() throws Exception {
    setRulesAvailableInTests(new TestAspects.BaseRule(), new AspectRequiringRule());
    pkg("a", "aspect(name='a', foo=[':b'])", "alias(name='b', actual=select({'//conditions:default': ':c'}))", "alias(name='c', actual=select({'//conditions:default': ':d'}))", "base(name='d')");
    ConfiguredTarget a = getConfiguredTarget("//a:a");
    assertThat(a.getProvider(RuleInfo.class).getData()).containsExactly("aspect //a:d", "rule //a:a");
}
Also used : BaseRule(com.google.devtools.build.lib.analysis.util.TestAspects.BaseRule) AspectRequiringRule(com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule) RuleInfo(com.google.devtools.build.lib.analysis.util.TestAspects.RuleInfo) TestAspects(com.google.devtools.build.lib.analysis.util.TestAspects) Test(org.junit.Test)

Aggregations

TestAspects (com.google.devtools.build.lib.analysis.util.TestAspects)5 AspectRequiringRule (com.google.devtools.build.lib.analysis.util.TestAspects.AspectRequiringRule)5 Test (org.junit.Test)5 BaseRule (com.google.devtools.build.lib.analysis.util.TestAspects.BaseRule)4 RuleInfo (com.google.devtools.build.lib.analysis.util.TestAspects.RuleInfo)4 AspectDescriptor (com.google.devtools.build.lib.packages.AspectDescriptor)1 Attribute (com.google.devtools.build.lib.packages.Attribute)1