Search in sources :

Example 1 with ResourceJarBuilder

use of com.google.devtools.build.buildjar.resourcejar.ResourceJarBuilder in project bazel by bazelbuild.

the class VanillaJavaBuilder method writeOutput.

/** Writes the class output jar, including any resource entries. */
private static void writeOutput(OptionsParser optionsParser) throws IOException {
    JarCreator jar = new JarCreator(optionsParser.getOutputJar());
    jar.setNormalize(true);
    jar.setCompression(optionsParser.compressJar());
    jar.addDirectory(optionsParser.getClassDir());
    // TODO(cushon): kill this once resource jar creation is decoupled from JavaBuilder
    try (ResourceJarBuilder resourceBuilder = new ResourceJarBuilder(ResourceJarOptions.builder().setMessages(ImmutableList.copyOf(optionsParser.getMessageFiles())).setResourceJars(ImmutableList.copyOf(optionsParser.getResourceJars())).setResources(ImmutableList.copyOf(optionsParser.getResourceFiles())).setClasspathResources(ImmutableList.copyOf(optionsParser.getRootResourceFiles())).build())) {
        resourceBuilder.build(jar);
    }
    jar.execute();
}
Also used : JarCreator(com.google.devtools.build.buildjar.jarhelper.JarCreator) ResourceJarBuilder(com.google.devtools.build.buildjar.resourcejar.ResourceJarBuilder)

Aggregations

JarCreator (com.google.devtools.build.buildjar.jarhelper.JarCreator)1 ResourceJarBuilder (com.google.devtools.build.buildjar.resourcejar.ResourceJarBuilder)1