Search in sources :

Example 1 with JaCoCoXmlReportGenerator

use of com.teamscale.report.jacoco.JaCoCoXmlReportGenerator in project teamscale-jacoco-agent by cqse.

the class Converter method runJaCoCoReportGeneration.

/**
 * Converts one .exec binary coverage file to XML.
 */
public void runJaCoCoReportGeneration() throws IOException, AgentOptionParseException {
    List<File> jacocoExecutionDataList = ReportUtils.listFiles(ETestArtifactFormat.JACOCO, arguments.getInputFiles());
    ExecFileLoader loader = new ExecFileLoader();
    for (File jacocoExecutionData : jacocoExecutionDataList) {
        loader.load(jacocoExecutionData);
    }
    SessionInfo sessionInfo = loader.getSessionInfoStore().getMerged("merged");
    ExecutionDataStore executionDataStore = loader.getExecutionDataStore();
    Logger logger = LoggingUtils.getLogger(this);
    JaCoCoXmlReportGenerator generator = new JaCoCoXmlReportGenerator(arguments.getClassDirectoriesOrZips(), getWildcardIncludeExcludeFilter(), arguments.getDuplicateClassFileBehavior(), arguments.shouldIgnoreUncoveredClasses, wrap(logger));
    try (Benchmark benchmark = new Benchmark("Generating the XML report")) {
        generator.convert(new Dump(sessionInfo, executionDataStore), Paths.get(arguments.outputFile).toFile());
    } catch (EmptyReportException e) {
        logger.warn("Converted report was emtpy.", e);
    }
}
Also used : Dump(com.teamscale.report.jacoco.dump.Dump) EmptyReportException(com.teamscale.report.jacoco.EmptyReportException) ExecutionDataStore(org.jacoco.core.data.ExecutionDataStore) Benchmark(com.teamscale.jacoco.agent.util.Benchmark) SessionInfo(org.jacoco.core.data.SessionInfo) JaCoCoXmlReportGenerator(com.teamscale.report.jacoco.JaCoCoXmlReportGenerator) Logger(org.slf4j.Logger) CommandLineLogger(com.teamscale.report.util.CommandLineLogger) ILogger(com.teamscale.report.util.ILogger) File(java.io.File) ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Aggregations

Benchmark (com.teamscale.jacoco.agent.util.Benchmark)1 EmptyReportException (com.teamscale.report.jacoco.EmptyReportException)1 JaCoCoXmlReportGenerator (com.teamscale.report.jacoco.JaCoCoXmlReportGenerator)1 Dump (com.teamscale.report.jacoco.dump.Dump)1 CommandLineLogger (com.teamscale.report.util.CommandLineLogger)1 ILogger (com.teamscale.report.util.ILogger)1 File (java.io.File)1 ExecutionDataStore (org.jacoco.core.data.ExecutionDataStore)1 SessionInfo (org.jacoco.core.data.SessionInfo)1 ExecFileLoader (org.jacoco.core.tools.ExecFileLoader)1 Logger (org.slf4j.Logger)1