Compare commits
No commits in common. "39f8125379f0b359ed169e7105f137eb659dd2d3" and "7d38fbe2c746d76932d9fc2fbd72222c7d1630b5" have entirely different histories.
39f8125379
...
7d38fbe2c7
8 changed files with 26 additions and 38 deletions
4
.idea/libraries/bld.xml
generated
4
.idea/libraries/bld.xml
generated
|
@ -2,11 +2,11 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.6.2.jar!/" />
|
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.6.1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.6.2-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.6.1-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
|
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
|
@ -27,7 +27,6 @@
|
||||||
<pattern value="rife.bld.extension.JacocoReportOperation" method="analyze" />
|
<pattern value="rife.bld.extension.JacocoReportOperation" method="analyze" />
|
||||||
<pattern value="rife.bld.extension.JacocoReportOperation" method="fromProject" />
|
<pattern value="rife.bld.extension.JacocoReportOperation" method="fromProject" />
|
||||||
<pattern value="rife.bld.extension.JacocoReportOperation" method="writeReports" />
|
<pattern value="rife.bld.extension.JacocoReportOperation" method="writeReports" />
|
||||||
<pattern value="rife.bld.extension.JacocoReportOperationBuild" method="pmd" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="PDMPlugin">
|
<component name="PDMPlugin">
|
||||||
<option name="skipTestSources" value="false" />
|
<option name="skipTestSources" value="false" />
|
||||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -7,7 +7,7 @@
|
||||||
],
|
],
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"${HOME}/.rife2/dist/rife2-1.6.2.jar",
|
"${HOME}/.rife2/dist/rife2-1.6.1.jar",
|
||||||
"lib/compile/*.jar",
|
"lib/compile/*.jar",
|
||||||
"lib/runtime/*.jar",
|
"lib/runtime/*.jar",
|
||||||
"lib/test/*.jar"
|
"lib/test/*.jar"
|
||||||
|
|
|
@ -31,6 +31,11 @@ public class ExamplesBuild extends Project {
|
||||||
new ExamplesBuild().start(args);
|
new ExamplesBuild().start(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void compile() throws Exception {
|
||||||
|
super.compile();
|
||||||
|
jacoco();
|
||||||
|
}
|
||||||
|
|
||||||
@BuildCommand(summary = "Generates Jacoco Reports")
|
@BuildCommand(summary = "Generates Jacoco Reports")
|
||||||
public void jacoco() throws Exception {
|
public void jacoco() throws Exception {
|
||||||
|
|
Binary file not shown.
|
@ -3,4 +3,4 @@ bld.downloadExtensionSources=true
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.1-SNAPSHOT
|
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.1-SNAPSHOT
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
rife2.downloadLocation=
|
rife2.downloadLocation=
|
||||||
rife2.version=1.6.2
|
rife2.version=1.6.1
|
|
@ -43,12 +43,12 @@ public class JacocoReportOperationBuild extends Project {
|
||||||
var jacocoVersion = new VersionNumber(0, 8, 10);
|
var jacocoVersion = new VersionNumber(0, 8, 10);
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("org.jacoco", "jacoco", jacocoVersion).exclude("*", "org.jacoco.doc"))
|
.include(dependency("org.jacoco", "jacoco", jacocoVersion).exclude("*", "org.jacoco.doc"))
|
||||||
.include(dependency("com.uwyn.rife2", "rife2", version(1, 6, 2)));
|
.include(dependency("com.uwyn.rife2", "rife2", version(1, 6, 1)));
|
||||||
scope(runtime)
|
scope(runtime)
|
||||||
.include(dependency("org.jacoco", "jacoco", jacocoVersion).exclude("*", "org.jacoco.doc"));
|
.include(dependency("org.jacoco", "jacoco", jacocoVersion).exclude("*", "org.jacoco.doc"));
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 3)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 3)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2)))
|
||||||
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
||||||
|
|
||||||
testOperation().mainClass("rife.bld.extension.JacocoReportOperationTest");
|
testOperation().mainClass("rife.bld.extension.JacocoReportOperationTest");
|
||||||
|
|
|
@ -26,19 +26,16 @@ import org.jacoco.report.csv.CSVFormatter;
|
||||||
import org.jacoco.report.html.HTMLFormatter;
|
import org.jacoco.report.html.HTMLFormatter;
|
||||||
import org.jacoco.report.xml.XMLFormatter;
|
import org.jacoco.report.xml.XMLFormatter;
|
||||||
import rife.bld.BaseProject;
|
import rife.bld.BaseProject;
|
||||||
import rife.bld.dependencies.VersionNumber;
|
import rife.bld.operations.AbstractOperation;
|
||||||
import rife.bld.operations.JUnitOperation;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,8 +44,7 @@ import java.util.stream.Collectors;
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class JacocoReportOperation extends JUnitOperation {
|
public class JacocoReportOperation extends AbstractOperation<JacocoReportOperation> {
|
||||||
private static final VersionNumber JACOCO_VERSION = new VersionNumber(0, 8, 10);
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(JacocoReportOperation.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(JacocoReportOperation.class.getName());
|
||||||
private final List<File> classFiles = new ArrayList<>();
|
private final List<File> classFiles = new ArrayList<>();
|
||||||
private final List<File> execFiles = new ArrayList<>();
|
private final List<File> execFiles = new ArrayList<>();
|
||||||
|
@ -73,10 +69,10 @@ public class JacocoReportOperation extends JUnitOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the locations of Java class files.
|
* Set the locations of Java class files.
|
||||||
**/
|
**/
|
||||||
public JacocoReportOperation classFiles(File... classFiles) {
|
public JacocoReportOperation classFiles(List<File> classFiles) {
|
||||||
this.classFiles.addAll(Arrays.stream(classFiles).toList());
|
this.classFiles.addAll(classFiles);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,42 +93,31 @@ public class JacocoReportOperation extends JUnitOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the locations of the JaCoCo *.exec files to read.
|
* Sets a list of JaCoCo *.exec files to read.
|
||||||
**/
|
**/
|
||||||
public JacocoReportOperation execFiles(File... execFiles) {
|
public JacocoReportOperation execFiles(List<File> execFiles) {
|
||||||
this.execFiles.addAll(Arrays.stream(execFiles).toList());
|
this.execFiles.addAll(execFiles);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the operation execution that can be wrapped by the {@code #executeOnce} call.
|
* Performs the operation execution that can be wrapped by the {@code #executeOnce} call.
|
||||||
*
|
*
|
||||||
|
* @throws Exception when an exception occurs during the execution
|
||||||
* @since 1.5.10
|
* @since 1.5.10
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public void execute() throws IOException {
|
public void execute() throws Exception {
|
||||||
if (project == null && LOGGER.isLoggable(Level.SEVERE)) {
|
if (project == null && LOGGER.isLoggable(Level.SEVERE)) {
|
||||||
LOGGER.severe("A project must be specified.");
|
LOGGER.severe("A project must be specified.");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var buildJacocoReportsDir = Path.of(project.buildDirectory().getPath(), "reports", "jacoco", "test").toFile();
|
var buildJacocoReportsDir = Path.of(project.buildDirectory().getPath(), "reports", "jacoco", "test").toFile();
|
||||||
var buildJacocoExecDir = Path.of(project.buildDirectory().getPath(), "jacoco").toFile();
|
|
||||||
var buildJacocoTestExec = new File(buildJacocoExecDir, "text.exec");
|
|
||||||
|
|
||||||
if (execFiles.isEmpty()) {
|
|
||||||
execFiles.add(buildJacocoTestExec);
|
|
||||||
|
|
||||||
//noinspection ResultOfMethodCallIgnored
|
|
||||||
buildJacocoExecDir.mkdirs();
|
|
||||||
|
|
||||||
javaOptions().javaAgent(new File(project.libBldDirectory(), "org.jacoco.agent-" + JACOCO_VERSION + ".jar"),
|
|
||||||
"destfile=" + buildJacocoTestExec +
|
|
||||||
",includes=" + classFiles.stream().map(File::toString).collect(Collectors.joining(",")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceFiles.isEmpty()) {
|
if (sourceFiles.isEmpty()) {
|
||||||
sourceFiles.add(project.srcDirectory());
|
sourceFiles.add(project.srcDirectory());
|
||||||
sourceFiles.add(project.srcTestDirectory());
|
//sourceFiles.add(project.srcTestDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (classFiles.isEmpty()) {
|
if (classFiles.isEmpty()) {
|
||||||
|
@ -233,12 +218,11 @@ public class JacocoReportOperation extends JUnitOperation {
|
||||||
/**
|
/**
|
||||||
* Sets the locations of the source files.
|
* Sets the locations of the source files.
|
||||||
**/
|
**/
|
||||||
public JacocoReportOperation sourceFiles(File... sourceFiles) {
|
public JacocoReportOperation sourceFiles(List<File> sourceFiles) {
|
||||||
this.sourceFiles.addAll(Arrays.stream(sourceFiles).toList());
|
this.sourceFiles.addAll(sourceFiles);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||||
private ISourceFileLocator sourceLocator() {
|
private ISourceFileLocator sourceLocator() {
|
||||||
var multi = new MultiSourceFileLocator(tabWidth);
|
var multi = new MultiSourceFileLocator(tabWidth);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue