From fa0f362e3d5b3da147e200172bf262960c899008 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 17 Jun 2024 02:58:19 -0700 Subject: [PATCH] Convert parameters from String to File whenever applicable --- .idea/copyright/Apache_License.xml | 4 +- .../rife/bld/extension/DokkaOperation.java | 88 ++++++++-- .../rife/bld/extension/dokka/SourceSet.java | 159 ++++++++++++++---- .../bld/extension/DokkaOperationTest.java | 18 +- .../java/rife/bld/extension/TestUtil.java | 40 +++++ .../extension/{ => dokka}/SourceSetTest.java | 46 ++--- 6 files changed, 273 insertions(+), 82 deletions(-) create mode 100644 src/test/java/rife/bld/extension/TestUtil.java rename src/test/java/rife/bld/extension/{ => dokka}/SourceSetTest.java (75%) diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml index ade80da..6f6eb53 100644 --- a/.idea/copyright/Apache_License.xml +++ b/.idea/copyright/Apache_License.xml @@ -1,6 +1,6 @@ - - + \ No newline at end of file diff --git a/src/main/java/rife/bld/extension/DokkaOperation.java b/src/main/java/rife/bld/extension/DokkaOperation.java index 758ec3a..5c20cb1 100644 --- a/src/main/java/rife/bld/extension/DokkaOperation.java +++ b/src/main/java/rife/bld/extension/DokkaOperation.java @@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Collectors; /** * Builds documentation (javadoc, HTML, etc.) using Dokka. @@ -37,6 +38,7 @@ */ @SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes") public class DokkaOperation extends AbstractProcessOperation { + public static final String SEMICOLON = ";"; private final static String GFM_PLUGIN_REGEXP = "^.*(dokka-base|analysis-kotlin-descriptors|gfm-plugin|freemarker).*\\.jar$"; private final static String HTML_PLUGIN_REGEXP = @@ -49,8 +51,8 @@ public class DokkaOperation extends AbstractProcessOperation { private final Map globalLinks_ = new ConcurrentHashMap<>(); private final Collection globalPackageOptions_ = new ArrayList<>(); private final Collection globalSrcLinks_ = new ArrayList<>(); - private final Collection includes_ = new ArrayList<>(); - private final Collection pluginsClasspath_ = new ArrayList<>(); + private final Collection includes_ = new ArrayList<>(); + private final Collection pluginsClasspath_ = new ArrayList<>(); private final Map pluginsConfiguration_ = new ConcurrentHashMap<>(); private boolean delayTemplateSubstitution_; private boolean failOnWarning_; @@ -81,8 +83,8 @@ private static String encodeJson(final String json) { * @param regex the regular expression to match * @return the list of JARs */ - public static List getJarList(File directory, String regex) { - var jars = new ArrayList(); + public static List getJarList(File directory, String regex) { + var jars = new ArrayList(); if (directory.isDirectory()) { var files = directory.listFiles(); @@ -90,7 +92,7 @@ public static List getJarList(File directory, String regex) { for (var f : files) { if (!f.getName().endsWith("-sources.jar") && (!f.getName().endsWith("-javadoc.jar")) && f.getName().matches(regex)) { - jars.add(f.getAbsolutePath()); + jars.add(f); } } } @@ -146,12 +148,12 @@ protected List executeConstructProcessCommandList() { // -jar dokka-cli args.add("-jar"); - args.add(cli.get(0)); + args.add(cli.get(0).getAbsolutePath()); // -pluginClasspath if (!pluginsClasspath_.isEmpty()) { args.add("-pluginsClasspath"); - args.add(String.join(";", pluginsClasspath_)); + args.add(pluginsClasspath_.stream().map(File::getAbsolutePath).collect(Collectors.joining(SEMICOLON))); } // -sourceSet @@ -195,19 +197,19 @@ protected List executeConstructProcessCommandList() { // -globalPackageOptions if (!globalPackageOptions_.isEmpty()) { args.add("-globalPackageOptions"); - args.add(String.join(";", globalPackageOptions_)); + args.add(String.join(SEMICOLON, globalPackageOptions_)); } // -globalSrcLinks if (!globalSrcLinks_.isEmpty()) { args.add("-globalSrcLinks_"); - args.add(String.join(";", globalSrcLinks_)); + args.add(String.join(SEMICOLON, globalSrcLinks_)); } // -includes if (!includes_.isEmpty()) { args.add("-includes"); - args.add(String.join(";", includes_)); + args.add(includes_.stream().map(File::getAbsolutePath).collect(Collectors.joining(SEMICOLON))); } // -loggingLevel @@ -268,7 +270,7 @@ protected List executeConstructProcessCommandList() { * Configures the operation from a {@link BaseProject}. *

* Sets the {@link #sourceSet sourceSet}, {@link SourceSet#jdkVersion jdkVersion}, {@link #moduleName moduleName} - * and {@link SourceSet#classpath(String...) classpath} from the project. + * and {@link SourceSet#classpath(File...) classpath} from the project. * * @param project the project to configure the operation from */ @@ -276,7 +278,7 @@ protected List executeConstructProcessCommandList() { public DokkaOperation fromProject(BaseProject project) { project_ = project; sourceSet_ = new SourceSet() - .src(new File(project.srcMainDirectory(), "kotlin").getAbsolutePath()) + .src(new File(project.srcMainDirectory(), "kotlin")) .classpath(project.compileClasspathJars()) .classpath(project.providedClasspathJars()); if (project.javaRelease() != null) { @@ -302,6 +304,15 @@ public DokkaOperation failOnWarning(Boolean failOnWarning) { return this; } + /** + * Retrieves the global external documentation links. + * + * @return the documentation links + */ + public Map getGlobalLinks() { + return globalLinks_; + } + /** * Set the global external documentation links. * @@ -348,6 +359,15 @@ public DokkaOperation globalPackageOptions(String... options) { return this; } + /** + * Retrieves the global list of package configurations. + * + * @return the package configurations + */ + public Collection globalPackageOptions() { + return globalPackageOptions_; + } + /** * Sets the global list of package configurations. *

@@ -381,6 +401,15 @@ public DokkaOperation globalSrcLink(String... links) { return this; } + /** + * Retrieves the global source links + * + * @return the source links + */ + public Collection globalSrcLink() { + return globalSrcLinks_; + } + /** * Sets the global mapping between a source directory and a Web service for browsing the code. * @@ -402,11 +431,20 @@ public DokkaOperation globalSrcLink(Collection links) { * @param files one or more files * @return this operation instance */ - public DokkaOperation includes(String... files) { + public DokkaOperation includes(File... files) { Collections.addAll(includes_, files); return this; } + /** + * Retrieves the markdown files that contain the module and package documentation. + * + * @return the markdown files + */ + public Collection includes() { + return includes_; + } + /** * Sets the Markdown files that contain module and package documentation. *

@@ -417,7 +455,7 @@ public DokkaOperation includes(String... files) { * @param files the list of files * @return this operation instance */ - public DokkaOperation includes(Collection files) { + public DokkaOperation includes(Collection files) { includes_.addAll(files); return this; } @@ -583,24 +621,42 @@ public DokkaOperation pluginConfigurations(Map pluginConfigurati return this; } + /** + * Retrieves the plugin configurations. + * + * @return the plugin configurations. + */ + public Map pluginConfigurations() { + return pluginsConfiguration_; + } + /** * Sets the list of jars with Dokka plugins and their dependencies. * * @param jars one or more jars * @return this operation instance */ - public DokkaOperation pluginsClasspath(String... jars) { + public DokkaOperation pluginsClasspath(File... jars) { Collections.addAll(pluginsClasspath_, jars); return this; } + /** + * Retrieves the plugins classpath. + * + * @return the classpath + */ + public Collection pluginsClasspath() { + return pluginsClasspath_; + } + /** * Sets the list of jars with Dokka plugins and their dependencies. * * @param jars the list of jars * @return this operation instance */ - public DokkaOperation pluginsClasspath(Collection jars) { + public DokkaOperation pluginsClasspath(Collection jars) { pluginsClasspath_.addAll(jars); return this; } diff --git a/src/main/java/rife/bld/extension/dokka/SourceSet.java b/src/main/java/rife/bld/extension/dokka/SourceSet.java index 727144b..5454d36 100644 --- a/src/main/java/rife/bld/extension/dokka/SourceSet.java +++ b/src/main/java/rife/bld/extension/dokka/SourceSet.java @@ -21,6 +21,7 @@ import java.io.File; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; /** * Configuration for a Dokka source set. @@ -29,17 +30,16 @@ * @since 1.0 */ public class SourceSet { - private static final String SEMICOLON = ";"; - private final Collection classpath_ = new ArrayList<>(); + private final Collection classpath_ = new ArrayList<>(); private final Map dependentSourceSets_ = new ConcurrentHashMap<>(); private final Collection documentedVisibilities_ = new ArrayList<>(); private final Map externalDocumentationLinks_ = new ConcurrentHashMap<>(); - private final Collection includes_ = new ArrayList<>(); + private final Collection includes_ = new ArrayList<>(); private final Collection perPackageOptions_ = new ArrayList<>(); - private final Collection samples_ = new ArrayList<>(); + private final Collection samples_ = new ArrayList<>(); private final Map srcLinks_ = new ConcurrentHashMap<>(); - private final Collection src_ = new ArrayList<>(); - private final Collection suppressedFiles_ = new ArrayList<>(); + private final Collection src_ = new ArrayList<>(); + private final Collection suppressedFiles_ = new ArrayList<>(); private AnalysisPlatform analysisPlatform_; private String apiVersion_; private String displayName_; @@ -110,7 +110,7 @@ public List args() { // -classpath if (!classpath_.isEmpty()) { args.add("-classpath"); - args.add(String.join(SEMICOLON, classpath_)); + args.add(classpath_.stream().map(File::getAbsolutePath).collect(Collectors.joining(DokkaOperation.SEMICOLON))); } // -dependentSourceSets @@ -118,7 +118,7 @@ public List args() { args.add("-dependentSourceSets"); var deps = new ArrayList(); dependentSourceSets_.forEach((k, v) -> deps.add(String.format("%s/%s", k, v))); - args.add(String.join(SEMICOLON, deps)); + args.add(String.join(DokkaOperation.SEMICOLON, deps)); } // -displayName @@ -132,7 +132,7 @@ public List args() { args.add("-documentedVisibilities"); var vis = new ArrayList(); documentedVisibilities_.forEach(d -> vis.add(d.name().toLowerCase())); - args.add(String.join(SEMICOLON, vis)); + args.add(String.join(DokkaOperation.SEMICOLON, vis)); } // -externalDocumentationLinks @@ -152,7 +152,7 @@ public List args() { // -includes if (!includes_.isEmpty()) { args.add("-includes"); - args.add(String.join(SEMICOLON, includes_)); + args.add(includes_.stream().map(File::getAbsolutePath).collect(Collectors.joining(DokkaOperation.SEMICOLON))); } // -languageVersion @@ -188,13 +188,13 @@ public List args() { // -perPackageOptions if (!perPackageOptions_.isEmpty()) { args.add("-perPackageOptions"); - args.add(String.join(SEMICOLON, perPackageOptions_)); + args.add(String.join(DokkaOperation.SEMICOLON, perPackageOptions_)); } // -samples if (!samples_.isEmpty()) { args.add("-samples"); - args.add(String.join(SEMICOLON, samples_)); + args.add(samples_.stream().map(File::getAbsolutePath).collect(Collectors.joining(DokkaOperation.SEMICOLON))); } // -skipDeprecated @@ -206,7 +206,7 @@ public List args() { // -src if (!src_.isEmpty()) { args.add("-src"); - args.add(String.join(SEMICOLON, src_)); + args.add(src_.stream().map(File::getAbsolutePath).collect(Collectors.joining(DokkaOperation.SEMICOLON))); } // -srcLink @@ -214,7 +214,7 @@ public List args() { args.add("-srcLink"); var links = new ArrayList(); srcLinks_.forEach((k, v) -> links.add(String.format("%s=%s", k, v))); - args.add(String.join(SEMICOLON, links)); + args.add(String.join(DokkaOperation.SEMICOLON, links)); } // -sourceSetName @@ -226,7 +226,7 @@ public List args() { // -suppressedFiles if (!suppressedFiles_.isEmpty()) { args.add("-suppressedFiles"); - args.add(String.join(SEMICOLON, suppressedFiles_)); + args.add(suppressedFiles_.stream().map(File::getAbsolutePath).collect(Collectors.joining(DokkaOperation.SEMICOLON))); } return args; @@ -242,7 +242,7 @@ public List args() { * @param files one or more file * @return this operation instance */ - public SourceSet classpath(String... files) { + public SourceSet classpath(File... files) { Collections.addAll(classpath_, files); return this; } @@ -257,24 +257,18 @@ public SourceSet classpath(String... files) { * @param files the list of files * @return this operation instance */ - public SourceSet classpath(Collection files) { + public SourceSet classpath(Collection files) { classpath_.addAll(files); return this; } /** - * Sets classpath for analysis and interactive samples. - *

- * This is useful if some types that come from dependencies are not resolved/picked up automatically. - *

- * This option accepts both {@code .jar} and {@code .klib} files. + * Retrieves the classpath for analysis and interactive samples. * - * @param files the list of files - * @return this operation instance + * @return the classpath */ - public SourceSet classpath(List files) { - files.forEach(it -> classpath_.add(it.getAbsolutePath())); - return this; + public Collection classpath() { + return classpath_; } /** @@ -289,6 +283,15 @@ public SourceSet dependentSourceSets(String moduleName, String sourceSetName) { return this; } + /** + * Retrieves the names of dependent source sets. + * + * @return the names + */ + public Map dependentSourceSets() { + return dependentSourceSets_; + } + /** * Sets the names of dependent source sets. * @@ -333,6 +336,15 @@ public SourceSet documentedVisibilities(DocumentedVisibility... visibilities) { return this; } + /** + * Retrieves the visibilities to be documented. + * + * @return the documented visibilities + */ + public Collection documentedVisibilities() { + return documentedVisibilities_; + } + /** * Sets the external documentation links. *

@@ -347,6 +359,15 @@ public SourceSet externalDocumentationLinks(String url, String packageListUrl) { return this; } + /** + * Retrieves the external documentation links. + * + * @return the documentation links. + */ + public Map externalDocumentationLinks() { + return externalDocumentationLinks_; + } + /** * Sets the external documentation links. *

@@ -372,11 +393,20 @@ public SourceSet externalDocumentationLinks(Map externalDocument * @param files one or more files * @return this operation instance */ - public SourceSet includes(String... files) { + public SourceSet includes(File... files) { Collections.addAll(includes_, files); return this; } + /** + * Retrieves the Markdown files that contain module and package documentation. + * + * @return the markdown files + */ + public Collection includes() { + return includes_; + } + /** * Sets the Markdown files that contain module and package documentation. *

@@ -388,7 +418,7 @@ public SourceSet includes(String... files) { * @param files the list of files * @return this operation instance */ - public SourceSet includes(Collection files) { + public SourceSet includes(Collection files) { includes_.addAll(files); return this; } @@ -517,6 +547,15 @@ public SourceSet perPackageOptions(Collection perPackageOptions) { return this; } + /** + * Retrieves the list of package source set configuration. + * + * @return the package source set configuration + */ + public Collection perPackageOptions() { + return perPackageOptions_; + } + /** * Set the list of package source set configuration. *

@@ -568,11 +607,20 @@ public SourceSet reportUndocumented(Boolean reportUndocumented) { * @param samples the list of samples * @return this operation instance */ - public SourceSet samples(Collection samples) { + public SourceSet samples(Collection samples) { samples_.addAll(samples); return this; } + /** + * Retrieves the list of directories or files that contain sample functions. + * + * @return the directories or files + */ + public Collection samples() { + return samples_; + } + /** * Set the list of directories or files that contain sample functions. *

@@ -582,7 +630,7 @@ public SourceSet samples(Collection samples) { * @param samples nne or more samples * @return this operation instance */ - public SourceSet samples(String... samples) { + public SourceSet samples(File... samples) { Collections.addAll(samples_, samples); return this; } @@ -622,7 +670,7 @@ public SourceSet sourceSetName(String sourceSetName) { * @param src the list of source code roots * @return this operation instance */ - public SourceSet src(Collection src) { + public SourceSet src(Collection src) { src_.addAll(src); return this; } @@ -636,11 +684,20 @@ public SourceSet src(Collection src) { * @param src pne ore moe source code roots * @return this operation instance */ - public SourceSet src(String... src) { + public SourceSet src(File... src) { Collections.addAll(src_, src); return this; } + /** + * Retrieves the source code roots to be analyzed and documented. + * + * @return the source code roots + */ + public Collection src() { + return src_; + } + /** * Sets the mapping between a source directory and a Web service for browsing the code. * @@ -654,6 +711,28 @@ public SourceSet srcLink(String srcPath, String remotePath, String lineSuffix) { return this; } + /** + * Sets the mapping between a source directory and a Web service for browsing the code. + * + * @param srcPath the source path + * @param remotePath the remote path + * @param lineSuffix the line suffix + * @return this operation instance + */ + public SourceSet srcLink(File srcPath, String remotePath, String lineSuffix) { + srcLinks_.put(srcPath.getAbsolutePath(), remotePath + lineSuffix); + return this; + } + + /** + * Retrieves the mapping between a source directory and a Web service for browsing the code. + * + * @return the source links + */ + public Map srcLinks() { + return srcLinks_; + } + /** * Sets the paths to files to be suppressed. *

@@ -662,11 +741,21 @@ public SourceSet srcLink(String srcPath, String remotePath, String lineSuffix) { * @param suppressedFiles the list of suppressed files * @return this operation instance */ - public SourceSet suppressedFiles(Collection suppressedFiles) { + public SourceSet suppressedFiles(Collection suppressedFiles) { suppressedFiles_.addAll(suppressedFiles); return this; } + + /** + * Retrieves the paths to files to be suppressed. + * + * @return the paths + */ + public Collection suppressedFiles() { + return suppressedFiles_; + } + /** * Sets the paths to files to be suppressed. *

@@ -675,7 +764,7 @@ public SourceSet suppressedFiles(Collection suppressedFiles) { * @param suppressedFiles one or moe suppressed files * @return this operation instance */ - public SourceSet suppressedFiles(String... suppressedFiles) { + public SourceSet suppressedFiles(File... suppressedFiles) { suppressedFiles_.addAll(Arrays.asList(suppressedFiles)); return this; } diff --git a/src/test/java/rife/bld/extension/DokkaOperationTest.java b/src/test/java/rife/bld/extension/DokkaOperationTest.java index e4ff292..14a1000 100644 --- a/src/test/java/rife/bld/extension/DokkaOperationTest.java +++ b/src/test/java/rife/bld/extension/DokkaOperationTest.java @@ -35,7 +35,7 @@ class DokkaOperationTest { @Test - @SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"}) + @SuppressWarnings({"PMD.AvoidDuplicateLiterals"}) void executeConstructProcessCommandListTest() throws IOException { var args = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-args.txt")); @@ -53,8 +53,8 @@ void executeConstructProcessCommandListTest() throws IOException { .globalPackageOptions(List.of("option3", "option4")) .globalSrcLink("link1", "link2") .globalSrcLink(List.of("link3", "link4")) - .includes("file1", "file2") - .includes(List.of("file3", "file4")) + .includes(new File("file1"), new File("file2")) + .includes(List.of(new File("file3"), new File("file4"))) .json(jsonConf) .loggingLevel(LoggingLevel.DEBUG) .moduleName("name") @@ -65,8 +65,8 @@ void executeConstructProcessCommandListTest() throws IOException { .outputFormat(OutputFormat.JAVADOC) .pluginConfigurations("name", "{\"json\"}") .pluginConfigurations(Map.of("{\"name2\"}", "json2", "name3}", "{json3")) - .pluginsClasspath("path1", "path2") - .pluginsClasspath(List.of("path3", "path4")) + .pluginsClasspath(new File("path1"), new File("path2")) + .pluginsClasspath(List.of(new File("path3"), new File("path4"))) .sourceSet(new SourceSet().classpath( List.of( new File("examples/foo.jar"), @@ -94,15 +94,17 @@ void executeConstructProcessCommandListTest() throws IOException { path + "/lib/bld/analysis-kotlin-descriptors-" + dokkaJar + ';' + path + "/lib/bld/javadoc-plugin-" + dokkaJar + ';' + path + "/lib/bld/korte-jvm-4.0.10.jar;" + - path + "/lib/bld/kotlin-as-java-plugin-" + dokkaJar + ";path1;path2;path3;path4", - "-sourceSet", "-src " + path + "/src/main/kotlin" + " -classpath " + path + "/foo.jar;" + path + "/bar.jar", + path + "/lib/bld/kotlin-as-java-plugin-" + dokkaJar + ';' + + TestUtil.localPath("path1", "path2", "path3", "path4"), + "-sourceSet", "-src " + path + "/src/main/kotlin" + " -classpath " + path + "/foo.jar;" + + path + "/bar.jar", "-outputDir", path + "/build", "-delayTemplateSubstitution", "-failOnWarning", "-globalLinks", "s^link^^s2^link2", "-globalPackageOptions", "option1;option2;option3;option4", "-globalSrcLinks_", "link1;link2;link3;link4", - "-includes", "file1;file2;file3;file4", + "-includes", TestUtil.localPath("file1", "file2", "file3", "file4"), "-loggingLevel", "debug", "-moduleName", "name", "-moduleVersion", "1.0", diff --git a/src/test/java/rife/bld/extension/TestUtil.java b/src/test/java/rife/bld/extension/TestUtil.java new file mode 100644 index 0000000..b6f9225 --- /dev/null +++ b/src/test/java/rife/bld/extension/TestUtil.java @@ -0,0 +1,40 @@ +/* + * Copyright 2023-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package rife.bld.extension; + +import java.io.File; +import java.util.Arrays; +import java.util.stream.Collectors; + +import static rife.bld.extension.DokkaOperation.SEMICOLON; + +@SuppressWarnings("PMD.TestClassWithoutTestCases") +public final class TestUtil { + private TestUtil() { + // no-op + } + + /** + * Returns the local path of the given file names. + * + * @param fileNames The file names + * @return the local path + */ + public static String localPath(String... fileNames) { + return Arrays.stream(fileNames).map(it -> new File(it).getAbsolutePath()).collect(Collectors.joining(SEMICOLON)); + } +} diff --git a/src/test/java/rife/bld/extension/SourceSetTest.java b/src/test/java/rife/bld/extension/dokka/SourceSetTest.java similarity index 75% rename from src/test/java/rife/bld/extension/SourceSetTest.java rename to src/test/java/rife/bld/extension/dokka/SourceSetTest.java index 8413b41..8eabcd1 100644 --- a/src/test/java/rife/bld/extension/SourceSetTest.java +++ b/src/test/java/rife/bld/extension/dokka/SourceSetTest.java @@ -14,13 +14,11 @@ * limitations under the License. */ -package rife.bld.extension; +package rife.bld.extension.dokka; import org.junit.jupiter.api.Test; -import rife.bld.extension.dokka.AnalysisPlatform; -import rife.bld.extension.dokka.DocumentedVisibility; -import rife.bld.extension.dokka.SourceSet; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -29,26 +27,32 @@ import java.util.stream.IntStream; import static org.assertj.core.api.Assertions.assertThat; +import static rife.bld.extension.TestUtil.localPath; class SourceSetTest { + public static final String SAMPLES_1 = "samples1"; + public static final String SAMPLES_2 = "samples2"; + public static final String SUP_1 = "sup1"; + public static final String SUP_2 = "sup2"; + @Test void sourceSetCollectionsTest() { var args = new SourceSet() - .classpath(List.of("path1", "path2")) + .classpath(List.of(new File("path1"), new File("path2"))) .dependentSourceSets(Map.of("set1", "set2", "set3", "set4")) .externalDocumentationLinks(Map.of("link1", "link2", "link3", "link4")) .perPackageOptions(List.of("option1", "option2")) - .samples(List.of("samples1", "samples1")) - .suppressedFiles(List.of("sup1", "sup2")) + .samples(List.of(new File(SAMPLES_1), new File(SAMPLES_2))) + .suppressedFiles(List.of(new File(SUP_1), new File(SUP_2))) .args(); var matches = List.of( - "-classpath", "path1;path2", + "-classpath", localPath("path1", "path2"), "-dependentSourceSets", "set1/set2;set3/set4", "-externalDocumentationLinks", "link3^link4^^link1^link2", "-perPackageOptions", "option1;option2", - "-samples", "samples1;samples1", - "-suppressedFiles", "sup1;sup2" + "-samples", localPath(SAMPLES_1, SAMPLES_2), + "-suppressedFiles", localPath(SUP_1, SUP_2) ); assertThat(args).hasSize(matches.size()); @@ -66,13 +70,13 @@ void sourceSetTest() throws IOException { var sourceSet = new SourceSet() .analysisPlatform(AnalysisPlatform.JVM) .apiVersion("1.0") - .classpath("classpath1", "classpath2") + .classpath(new File("classpath1"), new File("classpath2")) .dependentSourceSets("moduleName", "sourceSetName") .displayName("name") .documentedVisibilities(DocumentedVisibility.PACKAGE, DocumentedVisibility.PRIVATE) .externalDocumentationLinks("url1", "packageListUrl1") .externalDocumentationLinks("url2", "packageListUrl2") - .includes("includes1", "includes2") + .includes(new File("includes1"), new File("includes2")) .jdkVersion(18) .languageVersion("2.0") .noJdkLink(true) @@ -80,13 +84,13 @@ void sourceSetTest() throws IOException { .noStdlibLink(true) .perPackageOptions("options1", "options2") .reportUndocumented(true) - .samples("samples1", "sample2") + .samples(new File(SAMPLES_1), new File("sample2")) .skipDeprecated(true) .sourceSetName("setName") - .src("src1", "src2") + .src(new File("src1"), new File("src2")) .srcLink("path1", "remote1", "#suffix1") .srcLink("path2", "remote2", "#suffix2") - .suppressedFiles("sup1", "sup2"); + .suppressedFiles(new File(SUP_1), new File(SUP_2)); var params = sourceSet.args(); @@ -104,31 +108,31 @@ void sourceSetTest() throws IOException { var matches = List.of( "-analysisPlatform", "jvm", "-apiVersion", "1.0", - "-classpath", "classpath1;classpath2", + "-classpath", localPath("classpath1", "classpath2"), "-dependentSourceSets", "moduleName/sourceSetName", "-displayName", "name", "-documentedVisibilities", "package;private", "-externalDocumentationLinks", "url1^packageListUrl1^^url2^packageListUrl2", "-jdkVersion", "18", - "-includes", "includes1;includes2", + "-includes", localPath("includes1", "includes2"), "-languageVersion", "2.0", "-noJdkLink", "true", "-noSkipEmptyPackages", "true", "-noStdlibLink", "true", "-reportUndocumented", "true", "-perPackageOptions", "options1;options2", - "-samples", "samples1;sample2", + "-samples", localPath(SAMPLES_1, "sample2"), "-skipDeprecated", "true", - "-src", "src1;src2", + "-src", localPath("src1", "src2"), "-srcLink", "path1=remote1#suffix1;path2=remote2#suffix2", "-sourceSetName", "setName", - "-suppressedFiles", "sup1;sup2"); + "-suppressedFiles", localPath(SUP_1, SUP_2)); assertThat(params).hasSize(matches.size()); 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(new File("classpath1"), new File("classpath2"))); IntStream.range(0, params.size()).forEach(i -> assertThat(params.get(i)).isEqualTo(matches.get(i))); }