private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new SonarException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } finally { Closeables.closeQuietly(outputStream); } }
public void analyse(Project project, SensorContext context) { File reportUTs = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getReportPath()); File reportITs = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getItReportPath()); if ((!reportUTs.exists()) || (!reportITs.exists())) { return; } File reportOverall = new File(fileSystem.workingDir(), JACOCO_OVERALL); reportOverall.getParentFile().mkdirs(); mergeReports(reportOverall, reportUTs, reportITs); new OverallAnalyzer(reportOverall, perspectives).analyse(project, context); }
@Override public void analyse(Project project, SensorContext context) { File reportUTs = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getReportPath()); File reportITs = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getItReportPath()); File reportOverall = new File(fileSystem.workingDir(), JACOCO_OVERALL); reportOverall.getParentFile().mkdirs(); mergeReports(reportOverall, reportUTs, reportITs); new OverallAnalyzer(reportOverall, perspectives).analyse(project, context); }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new SonarException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } finally { Closeables.closeQuietly(outputStream); } }