Search in sources :

Example 6 with JavaBinaryRuleBuilder

use of com.facebook.buck.jvm.java.JavaBinaryRuleBuilder in project buck by facebook.

the class GenruleTest method createSampleJavaBinaryRule.

private BuildRule createSampleJavaBinaryRule(BuildRuleResolver ruleResolver) throws NoSuchBuildTargetException {
    // Create a java_binary that depends on a java_library so it is possible to create a
    // java_binary rule with a classpath entry and a main class.
    BuildRule javaLibrary = JavaLibraryBuilder.createBuilder(BuildTargetFactory.newInstance("//java/com/facebook/util:util")).addSrc(Paths.get("java/com/facebook/util/ManifestGenerator.java")).build(ruleResolver);
    BuildTarget buildTarget = BuildTargetFactory.newInstance("//java/com/facebook/util:ManifestGenerator");
    return new JavaBinaryRuleBuilder(buildTarget).setDeps(ImmutableSortedSet.of(javaLibrary.getBuildTarget())).setMainClass("com.facebook.util.ManifestGenerator").build(ruleResolver);
}
Also used : JavaBinaryRuleBuilder(com.facebook.buck.jvm.java.JavaBinaryRuleBuilder) BuildTarget(com.facebook.buck.model.BuildTarget) BuildRule(com.facebook.buck.rules.BuildRule)

Aggregations

JavaBinaryRuleBuilder (com.facebook.buck.jvm.java.JavaBinaryRuleBuilder)6 BuildTarget (com.facebook.buck.model.BuildTarget)4 BuildRule (com.facebook.buck.rules.BuildRule)3 FakeSourcePath (com.facebook.buck.rules.FakeSourcePath)2 TargetGraph (com.facebook.buck.rules.TargetGraph)2 VersionedAliasBuilder (com.facebook.buck.versions.VersionedAliasBuilder)2 Path (java.nio.file.Path)2 Test (org.junit.Test)2 BinaryBuildRule (com.facebook.buck.rules.BinaryBuildRule)1 NoopBuildRule (com.facebook.buck.rules.NoopBuildRule)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Before (org.junit.Before)1