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)));
}
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));
}
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));
}
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));
}
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)));
}
Aggregations