use of org.jacoco.core.tools.ExecDumpClient in project jacoco by jacoco.
the class DumpTask method execute.
@Override
public void execute() throws BuildException {
if (port <= 0) {
throw new BuildException("Invalid port value", getLocation());
}
if (dump && destfile == null) {
throw new BuildException("Destination file is required when dumping execution data", getLocation());
}
final ExecDumpClient client = new ExecDumpClient() {
@Override
protected void onConnecting(final InetAddress address, final int port) {
log(format("Connecting to %s:%s", address, Integer.valueOf(port)));
}
@Override
protected void onConnectionFailure(final IOException exception) {
log(exception.getMessage());
}
};
client.setDump(dump);
client.setReset(reset);
client.setRetryCount(retryCount);
try {
final ExecFileLoader loader = client.dump(address, port);
if (dump) {
log(format("Dumping execution data to %s", destfile.getAbsolutePath()));
loader.save(destfile, append);
}
} catch (final IOException e) {
throw new BuildException("Unable to dump coverage data", e, getLocation());
}
}
use of org.jacoco.core.tools.ExecDumpClient in project jacoco by jacoco.
the class Dump method execute.
@Override
public int execute(final PrintWriter out, final PrintWriter err) throws Exception {
final ExecDumpClient client = new ExecDumpClient() {
@Override
protected void onConnecting(final InetAddress address, final int port) {
out.printf("[INFO] Connecting to %s:%s.%n", address, Integer.valueOf(port));
}
@Override
protected void onConnectionFailure(final IOException exception) {
err.printf("[WARN] %s.%n", exception.getMessage());
}
};
client.setReset(reset);
client.setRetryCount(retrycount);
final ExecFileLoader loader = client.dump(address, port);
out.printf("[INFO] Writing execution data to %s.%n", destfile.getAbsolutePath());
loader.save(destfile, true);
return 0;
}
use of org.jacoco.core.tools.ExecDumpClient in project jacoco by jacoco.
the class DumpMojo method executeMojo.
@Override
public void executeMojo() throws MojoExecutionException {
final ExecDumpClient client = new ExecDumpClient() {
@Override
protected void onConnecting(final InetAddress address, final int port) {
getLog().info(format("Connecting to %s:%s", address, Integer.valueOf(port)));
}
@Override
protected void onConnectionFailure(final IOException exception) {
getLog().info(exception.getMessage());
}
};
client.setDump(dump);
client.setReset(reset);
client.setRetryCount(retryCount);
try {
final ExecFileLoader loader = client.dump(address, port);
if (dump) {
getLog().info(format("Dumping execution data to %s", destFile.getAbsolutePath()));
loader.save(destFile, append);
}
} catch (final IOException e) {
throw new MojoExecutionException("Unable to dump coverage data", e);
}
}
Aggregations