use of com.facebook.buck.python.PythonLibraryBuilder 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)));
}
use of com.facebook.buck.python.PythonLibraryBuilder in project buck by facebook.
the class LuaBinaryDescriptionTest method pythonDeps.
@Test
public void pythonDeps() throws Exception {
PythonLibraryBuilder pythonLibraryBuilder = new PythonLibraryBuilder(BuildTargetFactory.newInstance("//:dep")).setSrcs(SourceList.ofUnnamedSources(ImmutableSortedSet.of(new FakeSourcePath("foo.py"))));
LuaBinaryBuilder luaBinaryBuilder = new LuaBinaryBuilder(BuildTargetFactory.newInstance("//:rule")).setMainModule("hello.world").setDeps(ImmutableSortedSet.of(pythonLibraryBuilder.getTarget()));
TargetGraph targetGraph = TargetGraphFactory.newInstance(pythonLibraryBuilder.build(), luaBinaryBuilder.build());
ProjectFilesystem filesystem = new FakeProjectFilesystem();
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
pythonLibraryBuilder.build(resolver, filesystem, targetGraph);
LuaBinary luaBinary = luaBinaryBuilder.build(resolver, filesystem, targetGraph);
assertThat(luaBinary.getComponents().getPythonModules().keySet(), Matchers.hasItem("foo.py"));
}
use of com.facebook.buck.python.PythonLibraryBuilder in project buck by facebook.
the class LuaBinaryDescriptionTest method pythonInitIsRuntimeDepForInPlaceBinary.
@Test
public void pythonInitIsRuntimeDepForInPlaceBinary() throws Exception {
PythonLibraryBuilder pythonLibraryBuilder = new PythonLibraryBuilder(BuildTargetFactory.newInstance("//:dep")).setSrcs(SourceList.ofUnnamedSources(ImmutableSortedSet.of(new FakeSourcePath("foo.py"))));
LuaBinaryBuilder luaBinaryBuilder = new LuaBinaryBuilder(BuildTargetFactory.newInstance("//:rule")).setMainModule("hello.world").setPackageStyle(LuaConfig.PackageStyle.INPLACE).setDeps(ImmutableSortedSet.of(pythonLibraryBuilder.getTarget()));
TargetGraph targetGraph = TargetGraphFactory.newInstance(pythonLibraryBuilder.build(), luaBinaryBuilder.build());
ProjectFilesystem filesystem = new FakeProjectFilesystem();
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
pythonLibraryBuilder.build(resolver, filesystem, targetGraph);
LuaBinary luaBinary = luaBinaryBuilder.build(resolver, filesystem, targetGraph);
assertThat(luaBinary.getRuntimeDeps().collect(MoreCollectors.toImmutableSet()), Matchers.hasItem(PythonBinaryDescription.getEmptyInitTarget(luaBinary.getBuildTarget())));
}
Aggregations