use of com.google.devtools.build.buildjar.jarhelper.JarCreator in project bazel by bazelbuild.
the class IdlClass method writeOutputJar.
/** Writes the generated class files to the output jar. */
private static void writeOutputJar(Path outputJar, Path tempDir) throws IOException {
JarCreator output = new JarCreator(outputJar.toString());
output.setCompression(true);
output.setNormalize(true);
output.addDirectory(tempDir.toString());
output.execute();
}
use of com.google.devtools.build.buildjar.jarhelper.JarCreator in project bazel by bazelbuild.
the class ResourceJarBuilder method build.
public void build() throws IOException {
requireNonNull(options.output());
final JarCreator jar = new JarCreator(options.output());
build(jar);
jar.execute();
}
use of com.google.devtools.build.buildjar.jarhelper.JarCreator in project bazel by bazelbuild.
the class VanillaJavaBuilder method writeGeneratedSourceOutput.
/** Writes a jar containing any sources generated by annotation processors. */
private static void writeGeneratedSourceOutput(OptionsParser optionsParser) throws IOException {
if (optionsParser.getGeneratedSourcesOutputJar() == null) {
return;
}
JarCreator jar = new JarCreator(optionsParser.getGeneratedSourcesOutputJar());
jar.setNormalize(true);
jar.setCompression(optionsParser.compressJar());
jar.addDirectory(optionsParser.getSourceGenDir());
jar.execute();
}
use of com.google.devtools.build.buildjar.jarhelper.JarCreator 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();
}
use of com.google.devtools.build.buildjar.jarhelper.JarCreator in project bazel by bazelbuild.
the class JacocoInstrumentationProcessor method processRequest.
/**
* Instruments classes using Jacoco and keeps copies of uninstrumented class files in
* jacocoMetadataDir, to be zipped up in the output file jacocoMetadataOutput.
*/
public void processRequest(JavaLibraryBuildRequest build) throws IOException {
// running JavaBuilder locally, to remove stale entries from previous builds.
if (metadataDir != null) {
Path workDir = Paths.get(metadataDir);
if (Files.exists(workDir)) {
recursiveRemove(workDir);
}
Files.createDirectories(workDir);
}
JarCreator jar = new JarCreator(metadataOutput);
jar.setNormalize(true);
jar.setCompression(build.compressJar());
Instrumenter instr = new Instrumenter(new OfflineInstrumentationAccessGenerator());
// TODO(bazel-team): not sure whether Emma did anything fancier than this (multithreaded?)
instrumentRecursively(instr, Paths.get(build.getClassDir()));
jar.addDirectory(metadataDir);
jar.execute();
}
Aggregations