use of org.jacoco.report.DirectorySourceFileLocator in project jacoco by jacoco.
the class AntResourcesLocator method add.
/**
* Adds the given file or directory resource to the locator.
*
* @param resource
* resource to add
*/
void add(final Resource resource) {
empty = false;
if (resource.isDirectory()) {
final FileResource dir = (FileResource) resource;
super.add(new DirectorySourceFileLocator(dir.getFile(), encoding, getTabWidth()));
} else {
filesLocator.add(resource);
}
}
use of org.jacoco.report.DirectorySourceFileLocator in project buck by facebook.
the class ReportGenerator method createSourceFileLocator.
private ISourceFileLocator createSourceFileLocator() {
final MultiSourceFileLocator result = new MultiSourceFileLocator(TAB_WIDTH);
String[] sourceDirectoryPaths = sourcesPath.split(":");
for (String sourceDirectoryPath : sourceDirectoryPaths) {
File sourceDirectory = new File(sourceDirectoryPath);
result.add(new DirectorySourceFileLocator(sourceDirectory, "utf-8", TAB_WIDTH));
}
return result;
}
use of org.jacoco.report.DirectorySourceFileLocator in project jacoco by jacoco.
the class ReportGenerator method createReport.
private void createReport(final IBundleCoverage bundleCoverage) throws IOException {
// Create a concrete report visitor based on some supplied
// configuration. In this case we use the defaults
final HTMLFormatter htmlFormatter = new HTMLFormatter();
final IReportVisitor visitor = htmlFormatter.createVisitor(new FileMultiReportOutput(reportDirectory));
// Initialize the report with all of the execution and session
// information. At this point the report doesn't know about the
// structure of the report being created
visitor.visitInfo(execFileLoader.getSessionInfoStore().getInfos(), execFileLoader.getExecutionDataStore().getContents());
// Populate the report structure with the bundle coverage information.
// Call visitGroup if you need groups in your report.
visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(sourceDirectory, "utf-8", 4));
// Signal end of structure information to allow report to write all
// information out
visitor.visitEnd();
}
Aggregations