diff --git a/cliargs.sh b/cliargs.sh index 26016e6..dda5b47 100755 --- a/cliargs.sh +++ b/cliargs.sh @@ -2,16 +2,10 @@ java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -h |\ grep " -" |\ -sed -e "s/ -/\"-/" -e "s/ \[.*//" -e "s/ -.*//" -e "s/\$/\",/" -e '/help/d' |\ -sort |\ -sed -e '$s/,//' - -echo -echo ---------------------------------------- -echo +sed -e "s/^ -/-/" -e "s/ \[.*//" -e "s/ ->.*//" -e '/help/d' |\ +sort > "src/test/resources/dokka-args.txt" java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -sourceSet -h |\ grep " -" |\ -sed -e "s/ -/\"-/" -e "s/ \[.*//" -e "s/ -.*//" -e "s/\$/\",/" -e '/help/d' -e '/includeNonPublic/d' |\ -sort |\ -sed -e '$s/,//' +sed -e "s/^ -/-/" -e "s/ \[.*//" -e "s/ ->.*//" -e '/help/d' -e '/includeNonPublic/d' |\ +sort > "src/test/resources/dokka-sourceset-args.txt" diff --git a/src/test/java/rife/bld/extension/dokka/DokkaOperationTest.java b/src/test/java/rife/bld/extension/dokka/DokkaOperationTest.java index f0be118..f0a2207 100644 --- a/src/test/java/rife/bld/extension/dokka/DokkaOperationTest.java +++ b/src/test/java/rife/bld/extension/dokka/DokkaOperationTest.java @@ -20,6 +20,9 @@ import org.junit.jupiter.api.Test; import rife.bld.blueprints.BaseProjectBlueprint; 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.List; import java.util.Map; @@ -30,24 +33,11 @@ import static org.assertj.core.api.Assertions.assertThat; class DokkaOperationTest { @Test @SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"}) - void executeConstructProcessCommandListTest() { - var params = List.of( - "-delayTemplateSubstitution", - "-failOnWarning", - "-globalLinks", - "-globalPackageOptions", - "-globalSrcLink", - "-includes", - "-loggingLevel", - "-moduleName", - "-moduleVersion", - "-noSuppressObviousFunctions", - "-offlineMode", - "-outputDir", - "-pluginsClasspath", - "-pluginsConfiguration", - "-sourceSet", - "-suppressInheritedMembers"); + void executeConstructProcessCommandListTest() throws IOException { + var params = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-args.txt")); + + assertThat(params).isNotEmpty(); + var examples = new File("examples"); var jsonConf = new File("config.json"); var args = new DokkaOperation() diff --git a/src/test/java/rife/bld/extension/dokka/SourceSetTest.java b/src/test/java/rife/bld/extension/dokka/SourceSetTest.java index 3b5226e..b503335 100644 --- a/src/test/java/rife/bld/extension/dokka/SourceSetTest.java +++ b/src/test/java/rife/bld/extension/dokka/SourceSetTest.java @@ -18,6 +18,9 @@ package rife.bld.extension.dokka; 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.Map; import java.util.stream.IntStream; @@ -52,30 +55,11 @@ class SourceSetTest { @Test @SuppressWarnings("PMD.AvoidDuplicateLiterals") - void sourceSetTest() { - var params = List.of( - "-analysisPlatform", - "-apiVersion", - "-classpath", - "-dependentSourceSets", - "-displayName", - "-documentedVisibilities", - "-externalDocumentationLinks", - "-includes", - "-jdkVersion", - "-languageVersion", - "-noJdkLink", - "-noSkipEmptyPackages", - "-noStdlibLink", - "-perPackageOptions", - "-reportUndocumented", - "-samples", - "-skipDeprecated", - "-sourceSetName", - "-src", - "-srcLink", - "-suppressedFiles" - ); + void sourceSetTest() throws IOException { + var args = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-sourceset-args.txt")); + + assertThat(args).isNotEmpty(); + var sourceSet = new SourceSet() .analysisPlatform(AnalysisPlatform.JVM) .apiVersion("1.0") @@ -101,11 +85,11 @@ class SourceSetTest { .srcLink("path2", "remote2", "#suffix2") .suppressedFiles("sup1", "sup2"); - var args = sourceSet.args(); + var params = sourceSet.args(); - for (var p : params) { + for (var p : args) { var found = false; - for (var a : args) { + for (var a : params) { if (a.startsWith(p)) { found = true; break; @@ -137,12 +121,12 @@ class SourceSetTest { "-sourceSetName", "setName", "-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")); - 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))); } } diff --git a/src/test/resources/dokka-args.txt b/src/test/resources/dokka-args.txt new file mode 100644 index 0000000..4c9f29c --- /dev/null +++ b/src/test/resources/dokka-args.txt @@ -0,0 +1,16 @@ +-delayTemplateSubstitution +-failOnWarning +-globalLinks +-globalPackageOptions +-globalSrcLink +-includes +-loggingLevel +-moduleName +-moduleVersion +-noSuppressObviousFunctions +-offlineMode +-outputDir +-pluginsClasspath +-pluginsConfiguration +-sourceSet +-suppressInheritedMembers diff --git a/src/test/resources/dokka-sourceset-args.txt b/src/test/resources/dokka-sourceset-args.txt new file mode 100644 index 0000000..0699eb7 --- /dev/null +++ b/src/test/resources/dokka-sourceset-args.txt @@ -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