Added CLI parameters checks and script
This commit is contained in:
parent
57af36e761
commit
eb917b7cdf
7 changed files with 55 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
|
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.1
|
||||||
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.7-SNAPSHOT
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.7-SNAPSHOT
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.version=2.0.0-SNAPSHOT
|
bld.version=2.0.0-SNAPSHOT
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
|
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.1
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.2
|
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.2
|
||||||
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.version=2.0.0-SNAPSHOT
|
bld.version=2.0.0-SNAPSHOT
|
||||||
|
|
5
scripts/cliargs.sh
Executable file
5
scripts/cliargs.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
java -jar lib/compile/org.jacoco.cli-*-nodeps.jar report 2> >(grep "^ [<-]") |
|
||||||
|
cut -d' ' -f 2 |
|
||||||
|
sed -e "/help/d" >"src/test/resources/jacoco-args.txt"
|
|
@ -26,7 +26,8 @@ import rife.bld.publish.PublishScm;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.*;
|
import static rife.bld.dependencies.Repository.*;
|
||||||
import static rife.bld.dependencies.Scope.*;
|
import static rife.bld.dependencies.Scope.compile;
|
||||||
|
import static rife.bld.dependencies.Scope.test;
|
||||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||||
|
|
||||||
public class JacocoReportOperationBuild extends Project {
|
public class JacocoReportOperationBuild extends Project {
|
||||||
|
@ -97,4 +98,13 @@ public class JacocoReportOperationBuild extends Project {
|
||||||
.ruleSets("config/pmd.xml")
|
.ruleSets("config/pmd.xml")
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test() throws Exception {
|
||||||
|
new ExecOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.command("scripts/cliargs.sh")
|
||||||
|
.execute();
|
||||||
|
super.test();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,22 +151,22 @@ public class JacocoReportOperation extends AbstractOperation<JacocoReportOperati
|
||||||
/**
|
/**
|
||||||
* Sets the location of the CSV report.
|
* Sets the location of the CSV report.
|
||||||
*
|
*
|
||||||
* @param cvs the report location
|
* @param csv the report location
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public JacocoReportOperation csv(File cvs) {
|
public JacocoReportOperation csv(File csv) {
|
||||||
csv_ = cvs;
|
csv_ = csv;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the location of the CSV report.
|
* Sets the location of the CSV report.
|
||||||
*
|
*
|
||||||
* @param cvs the report location
|
* @param csv the report location
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public JacocoReportOperation csv(String cvs) {
|
public JacocoReportOperation csv(String csv) {
|
||||||
return csv(new File(cvs));
|
return csv(new File(csv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ 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.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
@ -53,6 +55,25 @@ class JacocoReportOperationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void checkAllParamsTest() throws IOException {
|
||||||
|
var supported = List.of("<execfiles>",
|
||||||
|
"--classfiles",
|
||||||
|
"--csv",
|
||||||
|
"--encoding",
|
||||||
|
"--html",
|
||||||
|
"--name",
|
||||||
|
"--quiet",
|
||||||
|
"--sourcefiles",
|
||||||
|
"--tabwith",
|
||||||
|
"--xml");
|
||||||
|
var args = Files.readAllLines(Paths.get("src", "test", "resources", "jacoco-args.txt"));
|
||||||
|
|
||||||
|
assertThat(args).isNotEmpty();
|
||||||
|
assertThat(supported).containsAll(args);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void executeFailureTest() {
|
void executeFailureTest() {
|
||||||
var op = new JacocoReportOperation().fromProject(new Project());
|
var op = new JacocoReportOperation().fromProject(new Project());
|
||||||
|
|
10
src/test/resources/jacoco-args.txt
Normal file
10
src/test/resources/jacoco-args.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<execfiles>
|
||||||
|
--classfiles
|
||||||
|
--csv
|
||||||
|
--encoding
|
||||||
|
--html
|
||||||
|
--name
|
||||||
|
--quiet
|
||||||
|
--sourcefiles
|
||||||
|
--tabwith
|
||||||
|
--xml
|
Loading…
Add table
Add a link
Reference in a new issue