use of org.jacoco.core.runtime.OfflineInstrumentationAccessGenerator 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