Search in sources :

Example 1 with DirectorySourceFileLocator

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);
    }
}
Also used : DirectorySourceFileLocator(org.jacoco.report.DirectorySourceFileLocator) FileResource(org.apache.tools.ant.types.resources.FileResource)

Example 2 with DirectorySourceFileLocator

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;
}
Also used : MultiSourceFileLocator(org.jacoco.report.MultiSourceFileLocator) DirectorySourceFileLocator(org.jacoco.report.DirectorySourceFileLocator) File(java.io.File)

Example 3 with DirectorySourceFileLocator

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();
}
Also used : FileMultiReportOutput(org.jacoco.report.FileMultiReportOutput) DirectorySourceFileLocator(org.jacoco.report.DirectorySourceFileLocator) HTMLFormatter(org.jacoco.report.html.HTMLFormatter) IReportVisitor(org.jacoco.report.IReportVisitor)

Aggregations

DirectorySourceFileLocator (org.jacoco.report.DirectorySourceFileLocator)3 File (java.io.File)1 FileResource (org.apache.tools.ant.types.resources.FileResource)1 FileMultiReportOutput (org.jacoco.report.FileMultiReportOutput)1 IReportVisitor (org.jacoco.report.IReportVisitor)1 MultiSourceFileLocator (org.jacoco.report.MultiSourceFileLocator)1 HTMLFormatter (org.jacoco.report.html.HTMLFormatter)1