Search in sources :

Example 1 with PythonLibrary

use of com.facebook.buck.python.PythonLibrary in project buck by facebook.

the class MavenUberJarTest method onlyJavaDepsIncluded.

@Test
public void onlyJavaDepsIncluded() throws NoSuchBuildTargetException {
    BuildTarget pythonTarget = BuildTargetFactory.newInstance("//:python");
    BuildTarget javaTarget = BuildTargetFactory.newInstance("//:java");
    PythonLibraryBuilder pythonLibraryBuilder = PythonLibraryBuilder.createBuilder(pythonTarget);
    JavaLibraryBuilder javaLibraryBuilder = JavaLibraryBuilder.createBuilder(javaTarget).addResource(new DefaultBuildTargetSourcePath(pythonTarget));
    TargetGraph targetGraph = TargetGraphFactory.newInstance(pythonLibraryBuilder.build(), javaLibraryBuilder.build());
    BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
    PythonLibrary pythonLibrary = pythonLibraryBuilder.build(resolver, filesystem, targetGraph);
    JavaLibrary javaLibrary = javaLibraryBuilder.build(resolver, filesystem, targetGraph);
    MavenUberJar buildRule = MavenUberJar.create(javaLibrary, javaLibraryBuilder.createBuildRuleParams(resolver, filesystem), Optional.of("com.facebook.buck.jvm.java:java:jar:42"), Optional.empty());
    assertThat(buildRule.getDeps(), Matchers.not(Matchers.hasItem(pythonLibrary)));
}
Also used : PythonLibrary(com.facebook.buck.python.PythonLibrary) BuildTarget(com.facebook.buck.model.BuildTarget) PythonLibraryBuilder(com.facebook.buck.python.PythonLibraryBuilder) TargetGraph(com.facebook.buck.rules.TargetGraph) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Aggregations

BuildTarget (com.facebook.buck.model.BuildTarget)1 PythonLibrary (com.facebook.buck.python.PythonLibrary)1 PythonLibraryBuilder (com.facebook.buck.python.PythonLibraryBuilder)1 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)1 DefaultBuildTargetSourcePath (com.facebook.buck.rules.DefaultBuildTargetSourcePath)1 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)1 TargetGraph (com.facebook.buck.rules.TargetGraph)1 Test (org.junit.Test)1