use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.
the class RobolectricTestDescriptionTest method rulesExportedFromProvidedDepsBecomeFirstOrderDeps.
@Test
public void rulesExportedFromProvidedDepsBecomeFirstOrderDeps() throws Exception {
SourcePathResolver emptyPathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
FakeBuildRule exportedRule = new FakeBuildRule("//:exported_rule", emptyPathResolver);
FakeExportDependenciesRule exportingRule = new FakeExportDependenciesRule("//:exporting_rule", emptyPathResolver, exportedRule);
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
TargetNode<?, ?> robolectricTestNode = RobolectricTestBuilder.createBuilder(target).addProvidedDep(exportingRule.getBuildTarget()).build();
TargetGraph targetGraph = TargetGraphFactory.newInstance(robolectricTestNode, FakeTargetNodeBuilder.build(exportedRule), FakeTargetNodeBuilder.build(exportingRule));
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
RobolectricTest robolectricTest = (RobolectricTest) resolver.requireRule(robolectricTestNode.getBuildTarget());
assertThat(robolectricTest.getCompiledTestsLibrary().getDeps(), Matchers.<BuildRule>hasItem(exportedRule));
}
use of com.facebook.buck.rules.FakeExportDependenciesRule in project buck by facebook.
the class RobolectricTestDescriptionTest method rulesExportedFromDepsBecomeFirstOrderDeps.
@Test
public void rulesExportedFromDepsBecomeFirstOrderDeps() throws Exception {
SourcePathResolver emptyPathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
FakeBuildRule exportedRule = new FakeBuildRule("//:exported_rule", emptyPathResolver);
FakeExportDependenciesRule exportingRule = new FakeExportDependenciesRule("//:exporting_rule", emptyPathResolver, exportedRule);
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
TargetNode<?, ?> robolectricTestNode = RobolectricTestBuilder.createBuilder(target).addDep(exportingRule.getBuildTarget()).build();
TargetGraph targetGraph = TargetGraphFactory.newInstance(robolectricTestNode, FakeTargetNodeBuilder.build(exportedRule), FakeTargetNodeBuilder.build(exportingRule));
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
RobolectricTest robolectricTest = (RobolectricTest) resolver.requireRule(robolectricTestNode.getBuildTarget());
assertThat(robolectricTest.getCompiledTestsLibrary().getDeps(), Matchers.<BuildRule>hasItem(exportedRule));
}
Aggregations