Read parameters from resource files

This commit is contained in:
Erik C. Thauvin 2024-05-27 21:35:58 -07:00
parent 749f43b6b2
commit f363e7dcce
Signed by: erik
GPG key ID: 776702A6A2DA330E
5 changed files with 63 additions and 58 deletions

View file

@ -2,16 +2,10 @@
java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -h |\ java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -h |\
grep " -" |\ grep " -" |\
sed -e "s/ -/\"-/" -e "s/ \[.*//" -e "s/ -.*//" -e "s/\$/\",/" -e '/help/d' |\ sed -e "s/^ -/-/" -e "s/ \[.*//" -e "s/ ->.*//" -e '/help/d' |\
sort |\ sort > "src/test/resources/dokka-args.txt"
sed -e '$s/,//'
echo
echo ----------------------------------------
echo
java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -sourceSet -h |\ java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -sourceSet -h |\
grep " -" |\ grep " -" |\
sed -e "s/ -/\"-/" -e "s/ \[.*//" -e "s/ -.*//" -e "s/\$/\",/" -e '/help/d' -e '/includeNonPublic/d' |\ sed -e "s/^ -/-/" -e "s/ \[.*//" -e "s/ ->.*//" -e '/help/d' -e '/includeNonPublic/d' |\
sort |\ sort > "src/test/resources/dokka-sourceset-args.txt"
sed -e '$s/,//'

View file

@ -20,6 +20,9 @@ import org.junit.jupiter.api.Test;
import rife.bld.blueprints.BaseProjectBlueprint; import rife.bld.blueprints.BaseProjectBlueprint;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -30,24 +33,11 @@ import static org.assertj.core.api.Assertions.assertThat;
class DokkaOperationTest { class DokkaOperationTest {
@Test @Test
@SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"}) @SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"})
void executeConstructProcessCommandListTest() { void executeConstructProcessCommandListTest() throws IOException {
var params = List.of( var params = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-args.txt"));
"-delayTemplateSubstitution",
"-failOnWarning", assertThat(params).isNotEmpty();
"-globalLinks",
"-globalPackageOptions",
"-globalSrcLink",
"-includes",
"-loggingLevel",
"-moduleName",
"-moduleVersion",
"-noSuppressObviousFunctions",
"-offlineMode",
"-outputDir",
"-pluginsClasspath",
"-pluginsConfiguration",
"-sourceSet",
"-suppressInheritedMembers");
var examples = new File("examples"); var examples = new File("examples");
var jsonConf = new File("config.json"); var jsonConf = new File("config.json");
var args = new DokkaOperation() var args = new DokkaOperation()

View file

@ -18,6 +18,9 @@ package rife.bld.extension.dokka;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@ -52,30 +55,11 @@ class SourceSetTest {
@Test @Test
@SuppressWarnings("PMD.AvoidDuplicateLiterals") @SuppressWarnings("PMD.AvoidDuplicateLiterals")
void sourceSetTest() { void sourceSetTest() throws IOException {
var params = List.of( var args = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-sourceset-args.txt"));
"-analysisPlatform",
"-apiVersion", assertThat(args).isNotEmpty();
"-classpath",
"-dependentSourceSets",
"-displayName",
"-documentedVisibilities",
"-externalDocumentationLinks",
"-includes",
"-jdkVersion",
"-languageVersion",
"-noJdkLink",
"-noSkipEmptyPackages",
"-noStdlibLink",
"-perPackageOptions",
"-reportUndocumented",
"-samples",
"-skipDeprecated",
"-sourceSetName",
"-src",
"-srcLink",
"-suppressedFiles"
);
var sourceSet = new SourceSet() var sourceSet = new SourceSet()
.analysisPlatform(AnalysisPlatform.JVM) .analysisPlatform(AnalysisPlatform.JVM)
.apiVersion("1.0") .apiVersion("1.0")
@ -101,11 +85,11 @@ class SourceSetTest {
.srcLink("path2", "remote2", "#suffix2") .srcLink("path2", "remote2", "#suffix2")
.suppressedFiles("sup1", "sup2"); .suppressedFiles("sup1", "sup2");
var args = sourceSet.args(); var params = sourceSet.args();
for (var p : params) { for (var p : args) {
var found = false; var found = false;
for (var a : args) { for (var a : params) {
if (a.startsWith(p)) { if (a.startsWith(p)) {
found = true; found = true;
break; break;
@ -137,12 +121,12 @@ class SourceSetTest {
"-sourceSetName", "setName", "-sourceSetName", "setName",
"-suppressedFiles", "sup1;sup2"); "-suppressedFiles", "sup1;sup2");
assertThat(args).hasSize(matches.size()); assertThat(params).hasSize(matches.size());
IntStream.range(0, args.size()).forEach(i -> assertThat(args.get(i)).isEqualTo(matches.get(i))); IntStream.range(0, params.size()).forEach(i -> assertThat(params.get(i)).isEqualTo(matches.get(i)));
sourceSet.classpath(List.of("classpath1", "classpath2")); sourceSet.classpath(List.of("classpath1", "classpath2"));
IntStream.range(0, args.size()).forEach(i -> assertThat(args.get(i)).isEqualTo(matches.get(i))); IntStream.range(0, params.size()).forEach(i -> assertThat(params.get(i)).isEqualTo(matches.get(i)));
} }
} }

View file

@ -0,0 +1,16 @@
-delayTemplateSubstitution
-failOnWarning
-globalLinks
-globalPackageOptions
-globalSrcLink
-includes
-loggingLevel
-moduleName
-moduleVersion
-noSuppressObviousFunctions
-offlineMode
-outputDir
-pluginsClasspath
-pluginsConfiguration
-sourceSet
-suppressInheritedMembers

View file

@ -0,0 +1,21 @@
-analysisPlatform
-apiVersion
-classpath
-dependentSourceSets
-displayName
-documentedVisibilities
-externalDocumentationLinks
-includes
-jdkVersion
-languageVersion
-noJdkLink
-noSkipEmptyPackages
-noStdlibLink
-perPackageOptions
-reportUndocumented
-samples
-skipDeprecated
-sourceSetName
-src
-srcLink
-suppressedFiles