Search in sources :

Example 1 with FakeExportDependenciesRule

use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.

the class AndroidLibraryDescriptionTest method rulesExportedFromProvidedDepsBecomeFirstOrderDeps.

@Test
public void rulesExportedFromProvidedDepsBecomeFirstOrderDeps() throws Exception {
    BuildRuleResolver resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
    FakeBuildRule transitiveExportedRule = resolver.addToIndex(new FakeBuildRule("//:transitive_exported_rule", pathResolver));
    FakeExportDependenciesRule exportedRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exported_rule", pathResolver, transitiveExportedRule));
    FakeExportDependenciesRule exportingRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exporting_rule", pathResolver, exportedRule));
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    BuildRule javaLibrary = AndroidLibraryBuilder.createBuilder(target).addProvidedDep(exportingRule.getBuildTarget()).build(resolver);
    assertThat(javaLibrary.getDeps(), Matchers.allOf(Matchers.hasItem(exportedRule), Matchers.hasItem(transitiveExportedRule)));
}
Also used : FakeExportDependenciesRule(com.facebook.buck.rules.FakeExportDependenciesRule) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildTarget(com.facebook.buck.model.BuildTarget) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildRule(com.facebook.buck.rules.BuildRule) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Example 2 with FakeExportDependenciesRule

use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.

the class JavaTestDescriptionTest method rulesExportedFromProvidedDepsBecomeFirstOrderDeps.

@Test
public void rulesExportedFromProvidedDepsBecomeFirstOrderDeps() throws Exception {
    BuildRuleResolver resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
    FakeBuildRule exportedRule = resolver.addToIndex(new FakeBuildRule("//:exported_rule", pathResolver));
    FakeExportDependenciesRule exportingRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exporting_rule", pathResolver, exportedRule));
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    JavaTest javaTest = JavaTestBuilder.createBuilder(target).addProvidedDep(exportingRule.getBuildTarget()).build(resolver);
    ImmutableSortedSet<BuildRule> deps = javaTest.getCompiledTestsLibrary().getDeps();
    assertThat(deps, Matchers.<BuildRule>hasItem(exportedRule));
}
Also used : FakeExportDependenciesRule(com.facebook.buck.rules.FakeExportDependenciesRule) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildTarget(com.facebook.buck.model.BuildTarget) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildRule(com.facebook.buck.rules.BuildRule) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Example 3 with FakeExportDependenciesRule

use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.

the class JavaTestDescriptionTest method rulesExportedFromDepsBecomeFirstOrderDeps.

@Test
public void rulesExportedFromDepsBecomeFirstOrderDeps() throws Exception {
    BuildRuleResolver resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
    FakeBuildRule exportedRule = resolver.addToIndex(new FakeBuildRule("//:exported_rule", pathResolver));
    FakeExportDependenciesRule exportingRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exporting_rule", pathResolver, exportedRule));
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    JavaTest javaTest = JavaTestBuilder.createBuilder(target).addDep(exportingRule.getBuildTarget()).build(resolver);
    ImmutableSortedSet<BuildRule> deps = javaTest.getCompiledTestsLibrary().getDeps();
    assertThat(deps, Matchers.<BuildRule>hasItem(exportedRule));
}
Also used : FakeExportDependenciesRule(com.facebook.buck.rules.FakeExportDependenciesRule) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildTarget(com.facebook.buck.model.BuildTarget) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildRule(com.facebook.buck.rules.BuildRule) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Example 4 with FakeExportDependenciesRule

use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.

the class JavaLibraryDescriptionTest method setUp.

@Before
public void setUp() {
    resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
    exportedRule = resolver.addToIndex(new FakeBuildRule("//:exported_rule", pathResolver));
    exportingRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exporting_rule", pathResolver, exportedRule));
}
Also used : FakeExportDependenciesRule(com.facebook.buck.rules.FakeExportDependenciesRule) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Before(org.junit.Before)

Example 5 with FakeExportDependenciesRule

use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.

the class AndroidLibraryDescriptionTest method rulesExportedFromDepsBecomeFirstOrderDeps.

@Test
public void rulesExportedFromDepsBecomeFirstOrderDeps() throws Exception {
    BuildRuleResolver resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
    FakeBuildRule transitiveExportedRule = resolver.addToIndex(new FakeBuildRule("//:transitive_exported_rule", pathResolver));
    FakeExportDependenciesRule exportedRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exported_rule", pathResolver, transitiveExportedRule));
    FakeExportDependenciesRule exportingRule = resolver.addToIndex(new FakeExportDependenciesRule("//:exporting_rule", pathResolver, exportedRule));
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    BuildRule javaLibrary = AndroidLibraryBuilder.createBuilder(target).addDep(exportingRule.getBuildTarget()).build(resolver);
    assertThat(javaLibrary.getDeps(), Matchers.allOf(Matchers.hasItem(exportedRule), Matchers.hasItem(transitiveExportedRule)));
}
Also used : FakeExportDependenciesRule(com.facebook.buck.rules.FakeExportDependenciesRule) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildTarget(com.facebook.buck.model.BuildTarget) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildRule(com.facebook.buck.rules.BuildRule) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Aggregations

BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)7 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)7 FakeBuildRule (com.facebook.buck.rules.FakeBuildRule)7 FakeExportDependenciesRule (com.facebook.buck.rules.FakeExportDependenciesRule)7 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)7 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)7 BuildTarget (com.facebook.buck.model.BuildTarget)6 Test (org.junit.Test)6 BuildRule (com.facebook.buck.rules.BuildRule)4 TargetGraph (com.facebook.buck.rules.TargetGraph)2 Before (org.junit.Before)1