Compare commits

...

4 commits

5 changed files with 93 additions and 8 deletions

View file

@ -3,12 +3,15 @@
TMPNEW=/tmp/checkcliargs-new
TMPOLD=/tmp/checkcliargs-old
cd lib/compile
java -cp "*" -jar dokka-cli-*.jar -h >$TMPNEW
cd ../../examples/lib/bld
java -cp "*" -jar dokka-cli-*.jar -h >$TMPOLD
java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -h >$TMPNEW
java -cp "/examples/lib/bld*" -jar examples/lib/bld/dokka-cli-*.jar -h >$TMPOLD
diff $TMPOLD $TMPNEW
java -cp "lib/compile/*" -jar lib/compile/dokka-cli-*.jar -sourceSet -h >$TMPNEW
java -cp "/examples/lib/bld*" -jar examples/lib/bld/dokka-cli-*.jar -sourceSet -h >$TMPOLD
diff $TMPOLD $TMPNEW
rm -rf $TMPNEW $TMPOLD

View file

@ -56,7 +56,7 @@ public class CompileKotlinOperationBuild extends Project {
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
.include(dependency("org.assertj", "assertj-core", version(3, 25, 3)));
.include(dependency("org.assertj", "assertj-core", version(3, 26, 0)));
javadocOperation()
.javadocOptions()

View file

@ -54,6 +54,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
private final Map<String, String> pluginsConfiguration_ = new ConcurrentHashMap<>();
private boolean delayTemplateSubstitution_;
private boolean failOnWarning_;
private File json;
private LoggingLevel loggingLevel_;
private String moduleName_;
private String moduleVersion_;
@ -216,6 +217,11 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
args.add("-suppressInheritedMembers");
}
// json
if (json != null) {
args.add(json.getAbsolutePath());
}
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.join(" ", args));
}
@ -381,6 +387,16 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
return this;
}
/**
* JSON configuration file path.
*
* @param configuration the configuration file path
*/
public DokkaOperation json(File configuration) {
json = configuration;
return this;
}
/**
* Sets the logging level.
*

View file

@ -31,7 +31,25 @@ class DokkaOperationTest {
@Test
@SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"})
void executeConstructProcessCommandListTest() {
var params = List.of(
"-moduleName",
"-moduleVersion",
"-outputDir",
"-sourceSet",
"-pluginsConfiguration",
"-pluginsClasspath",
"-offlineMode",
"-failOnWarning",
"-delayTemplateSubstitution",
"-noSuppressObviousFunctions",
"-includes",
"-suppressInheritedMembers",
"-globalPackageOptions",
"-globalLinks",
"-globalSrcLink",
"-loggingLevel");
var examples = new File("examples");
var jsonConf = new File("config.json");
var args = new DokkaOperation()
.fromProject(new BaseProjectBlueprint(examples, "com.example", "Example"))
.globalLinks("s", "link")
@ -41,6 +59,7 @@ class DokkaOperationTest {
.globalSrcLink("link1", "link2")
.globalSrcLink(List.of("link3", "link4"))
.includes("file1", "file2")
.includes(List.of("file3", "file4"))
.pluginConfigurations("name", "{\"json\"}")
.pluginConfigurations(Map.of("{\"name2\"}", "json2", "name3}", "{json3"))
.pluginsClasspath("path1", "path2")
@ -60,8 +79,20 @@ class DokkaOperationTest {
new File("examples/foo.jar"),
new File("examples/bar.jar")
)))
.json(jsonConf)
.executeConstructProcessCommandList();
for (var p : params) {
var found = false;
for (var a : args) {
if (a.startsWith(p)) {
found = true;
break;
}
}
assertThat(found).as(p + " not found.").isTrue();
}
var path = examples.getAbsolutePath();
var dokkaJar = "1.9.20.jar";
var matches = List.of("java",
@ -78,14 +109,15 @@ class DokkaOperationTest {
"-globalLinks", "s^link^^s2^link2",
"-globalPackageOptions", "option1;option2;option3;option4",
"-globalSrcLinks_", "link1;link2;link3;link4",
"-includes", "file1;file2",
"-includes", "file1;file2;file3;file4",
"-loggingLevel", "debug",
"-moduleName", "name",
"-moduleVersion", "1.0",
"-noSuppressObviousFunctions",
"-offlineMode",
"-pluginsConfiguration", "{\\\"name2\\\"}={json2}^^{name}={\\\"json\\\"}^^{name3}}={{json3}",
"-suppressInheritedMembers");
"-suppressInheritedMembers",
jsonConf.getAbsolutePath());
assertThat(args).hasSize(matches.size());

View file

@ -53,6 +53,29 @@ class SourceSetTest {
@Test
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
void sourceSetTest() {
var params = List.of(
"-sourceSetName",
"-displayName",
"-classpath",
"-src",
"-dependentSourceSets",
"-samples",
"-includes",
"-documentedVisibilities",
"-reportUndocumented",
"-noSkipEmptyPackages",
"-skipDeprecated",
"-jdkVersion",
"-languageVersion",
"-apiVersion",
"-noStdlibLink",
"-noJdkLink",
"-suppressedFiles",
"-analysisPlatform",
"-perPackageOptions",
"-externalDocumentationLinks",
"-srcLink"
);
var sourceSet = new SourceSet()
.classpath("classpath1", "classpath2")
.dependentSourceSets("moduleName", "sourceSetName")
@ -80,6 +103,17 @@ class SourceSetTest {
var args = sourceSet.args();
for (var p : params) {
var found = false;
for (var a : args) {
if (a.startsWith(p)) {
found = true;
break;
}
}
assertThat(found).as(p + " not found.").isTrue();
}
var matches = List.of(
"-analysisPlatform", "jvm",
"-apiVersion", "1.0",