Search in sources :

Example 1 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class MergeTask method execute.

@Override
public void execute() throws BuildException {
    if (destfile == null) {
        throw new BuildException("Destination file must be supplied", getLocation());
    }
    final ExecFileLoader loader = new ExecFileLoader();
    load(loader);
    save(loader);
}
Also used : BuildException(org.apache.tools.ant.BuildException) ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Example 2 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class MergeTest method loadExecFile.

private Set<String> loadExecFile(File file) throws IOException {
    ExecFileLoader loader = new ExecFileLoader();
    loader.load(file);
    Set<String> names = new HashSet<String>();
    for (ExecutionData d : loader.getExecutionDataStore().getContents()) {
        names.add(d.getName());
    }
    return names;
}
Also used : ExecFileLoader(org.jacoco.core.tools.ExecFileLoader) HashSet(java.util.HashSet) ExecutionData(org.jacoco.core.data.ExecutionData)

Example 3 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class Merge method execute.

@Override
public int execute(final PrintWriter out, final PrintWriter err) throws IOException {
    final ExecFileLoader loader = loadExecutionData(out);
    out.printf("[INFO] Writing execution data to %s.%n", destfile.getAbsolutePath());
    loader.save(destfile, true);
    return 0;
}
Also used : ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Example 4 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class Report method execute.

@Override
public int execute(final PrintWriter out, final PrintWriter err) throws IOException {
    final ExecFileLoader loader = loadExecutionData(out);
    final IBundleCoverage bundle = analyze(loader.getExecutionDataStore(), out);
    writeReports(bundle, loader, out);
    return 0;
}
Also used : IBundleCoverage(org.jacoco.core.analysis.IBundleCoverage) ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Example 5 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class Report method loadExecutionData.

private ExecFileLoader loadExecutionData(final PrintWriter out) throws IOException {
    final ExecFileLoader loader = new ExecFileLoader();
    if (execfiles.isEmpty()) {
        out.println("[WARN] No execution data files provided.");
    } else {
        for (final File file : execfiles) {
            out.printf("[INFO] Loading execution data file %s.%n", file.getAbsolutePath());
            loader.load(file);
        }
    }
    return loader;
}
Also used : File(java.io.File) ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Aggregations

ExecFileLoader (org.jacoco.core.tools.ExecFileLoader)14 IOException (java.io.IOException)4 InetAddress (java.net.InetAddress)3 BuildException (org.apache.tools.ant.BuildException)3 ExecDumpClient (org.jacoco.core.tools.ExecDumpClient)3 File (java.io.File)2 IBundleCoverage (org.jacoco.core.analysis.IBundleCoverage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 Resource (org.apache.tools.ant.types.Resource)1 FileResource (org.apache.tools.ant.types.resources.FileResource)1 ExecutionData (org.jacoco.core.data.ExecutionData)1 Test (org.junit.Test)1