diff --git a/.idea/bld.xml b/.idea/bld.xml deleted file mode 100644 index 6600cee..0000000 --- a/.idea/bld.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/Run Tests.xml b/.idea/runConfigurations/Run Tests.xml new file mode 100644 index 0000000..057a90e --- /dev/null +++ b/.idea/runConfigurations/Run Tests.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index 9834218..7719b26 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,8 +1,8 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.1-SNAPSHOT -bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.1-SNAPSHOT +bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.0 +bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.0 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.sourceDirectories= bld.version=2.0.1 diff --git a/examples/src/bld/java/com/example/ExampleBuild.java b/examples/src/bld/java/com/example/ExampleBuild.java index 1e6c71b..f6a2f09 100644 --- a/examples/src/bld/java/com/example/ExampleBuild.java +++ b/examples/src/bld/java/com/example/ExampleBuild.java @@ -34,13 +34,13 @@ public class ExampleBuild extends Project { repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES); - final var kotlin = version(2, 0, 20); + final var kotlin = version(2, 0, 0); scope(compile) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)); scope(test) .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin)) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0))); + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))); // Include the Kotlin source directory when creating or publishing sources Java Archives jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin")); diff --git a/src/bld/java/rife/bld/extension/DokkaOperationBuild.java b/src/bld/java/rife/bld/extension/DokkaOperationBuild.java index 97d313c..8923f78 100644 --- a/src/bld/java/rife/bld/extension/DokkaOperationBuild.java +++ b/src/bld/java/rife/bld/extension/DokkaOperationBuild.java @@ -33,7 +33,7 @@ public class DokkaOperationBuild extends Project { public DokkaOperationBuild() { pkg = "rife.bld.extension"; name = "bld-dokka"; - version = version(1, 0, 1, "SNAPSHOT"); + version = version(1, 0, 0); javaRelease = 17; @@ -51,8 +51,8 @@ public class DokkaOperationBuild extends Project { .include(dependency("org.jetbrains.dokka", "jekyll-plugin", dokka)) .include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1))); scope(test) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0))) + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))) .include(dependency("org.assertj", "assertj-core", version(3, 26, 3))); javadocOperation() diff --git a/src/main/java/rife/bld/extension/DokkaOperation.java b/src/main/java/rife/bld/extension/DokkaOperation.java index c3e71c0..03f9323 100644 --- a/src/main/java/rife/bld/extension/DokkaOperation.java +++ b/src/main/java/rife/bld/extension/DokkaOperation.java @@ -26,11 +26,7 @@ import rife.tools.StringUtils; import java.io.File; import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -450,7 +446,8 @@ public class DokkaOperation extends AbstractProcessOperation { * @return this operation instance */ public DokkaOperation includes(File... files) { - return includes(List.of(files)); + includes_.addAll(List.of(files)); + return this; } /** @@ -464,24 +461,10 @@ public class DokkaOperation extends AbstractProcessOperation { * @return this operation instance */ public DokkaOperation includes(String... files) { - return includesStrings(List.of(files)); + includes_.addAll(Arrays.stream(files).map(File::new).toList()); + return this; } - /** - * Sets the Markdown files that contain module and package documentation. - *

- * The contents of specified files are parsed and embedded into documentation as module and package descriptions. - *

- * This can be configured on per-package basis. - * - * @param files one or more files - * @return this operation instance - */ - public DokkaOperation includes(Path... files) { - return includesPaths(List.of(files)); - } - - /** * Retrieves the markdown files that contain the module and package documentation. * @@ -506,36 +489,6 @@ public class DokkaOperation extends AbstractProcessOperation { return this; } - /** - * Sets the Markdown files that contain module and package documentation. - *

- * The contents of specified files are parsed and embedded into documentation as module and package descriptions. - *

- * This can be configured on per-package basis. - * - * @param files the markdown files - * @return this operation instance - */ - public DokkaOperation includesPaths(Collection files) { - includes_.addAll(files.stream().map(Path::toFile).toList()); - return this; - } - - /** - * Sets the Markdown files that contain module and package documentation. - *

- * The contents of specified files are parsed and embedded into documentation as module and package descriptions. - *

- * This can be configured on per-package basis. - * - * @param files the markdown files - * @return this operation instance - */ - public DokkaOperation includesStrings(Collection files) { - includes_.addAll(files.stream().map(File::new).toList()); - return this; - } - /** * JSON configuration file path. * @@ -546,33 +499,6 @@ public class DokkaOperation extends AbstractProcessOperation { return this; } - /** - * JSON configuration file path. - * - * @param configuration the configuration file path - */ - public DokkaOperation json(Path configuration) { - return json(configuration.toFile()); - } - - /** - * Retrieves the JSON configuration file path. - * - * @return the configuration file path - */ - public File json() { - return json_; - } - - /** - * JSON configuration file path. - * - * @param configuration the configuration file path - */ - public DokkaOperation json(String configuration) { - return json(new File(configuration)); - } - /** * Sets the logging level. * @@ -663,15 +589,6 @@ public class DokkaOperation extends AbstractProcessOperation { return this; } - /** - * Retrieves the output directory path. - * - * @return the output directory - */ - public File outputDir() { - return outputDir_; - } - /** * Sets the output directory path, {@code ./dokka} by default. *

@@ -681,19 +598,8 @@ public class DokkaOperation extends AbstractProcessOperation { * @return this operation instance */ public DokkaOperation outputDir(String outputDir) { - return outputDir(new File(outputDir)); - } - - /** - * Sets the output directory path, {@code ./dokka} by default. - *

- * The directory to where documentation is generated, regardless of output format. - * - * @param outputDir the output directory - * @return this operation instance - */ - public DokkaOperation outputDir(Path outputDir) { - return outputDir(outputDir.toFile()); + outputDir_ = new File(outputDir); + return this; } /** @@ -735,12 +641,12 @@ public class DokkaOperation extends AbstractProcessOperation { /** * Sets the configuration for Dokka plugins. * - * @param pluginConfigurations the map of configurations + * @param pluginConfiguratione the map of configurations * @return this operation instance * @see #pluginConfigurations(String, String) */ - public DokkaOperation pluginConfigurations(Map pluginConfigurations) { - pluginsConfiguration_.putAll(pluginConfigurations); + public DokkaOperation pluginConfigurations(Map pluginConfiguratione) { + pluginsConfiguration_.putAll(pluginConfiguratione); return this; } @@ -760,7 +666,8 @@ public class DokkaOperation extends AbstractProcessOperation { * @return this operation instance */ public DokkaOperation pluginsClasspath(File... jars) { - return pluginsClasspath(List.of(jars)); + pluginsClasspath_.addAll(List.of(jars)); + return this; } /** @@ -770,17 +677,8 @@ public class DokkaOperation extends AbstractProcessOperation { * @return this operation instance */ public DokkaOperation pluginsClasspath(String... jars) { - return pluginsClasspathStrings(List.of(jars)); - } - - /** - * Sets the jars for Dokka plugins and their dependencies. - * - * @param jars one or more jars - * @return this operation instance - */ - public DokkaOperation pluginsClasspath(Path... jars) { - return pluginsClasspathPaths(List.of(jars)); + pluginsClasspath_.addAll(Arrays.stream(jars).map(File::new).toList()); + return this; } /** @@ -803,28 +701,6 @@ public class DokkaOperation extends AbstractProcessOperation { return this; } - /** - * Sets the jars for Dokka plugins and their dependencies. - * - * @param jars the jars - * @return this operation instance - */ - public DokkaOperation pluginsClasspathPaths(Collection jars) { - pluginsClasspath_.addAll(jars.stream().map(Path::toFile).toList()); - return this; - } - - /** - * Sets the jars for Dokka plugins and their dependencies. - * - * @param jars the jars - * @return this operation instance - */ - public DokkaOperation pluginsClasspathStrings(Collection jars) { - pluginsClasspath_.addAll(jars.stream().map(File::new).toList()); - return this; - } - /** * Sets the configurations for a source set. *

diff --git a/src/main/java/rife/bld/extension/dokka/SourceSet.java b/src/main/java/rife/bld/extension/dokka/SourceSet.java index 78a7074..2b5f24a 100644 --- a/src/main/java/rife/bld/extension/dokka/SourceSet.java +++ b/src/main/java/rife/bld/extension/dokka/SourceSet.java @@ -19,11 +19,7 @@ package rife.bld.extension.dokka; import rife.bld.extension.DokkaOperation; import java.io.File; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -242,7 +238,8 @@ public class SourceSet { * @return this operation instance */ public SourceSet classpath(File... files) { - return classpath(List.of(files)); + classpath_.addAll(List.of(files)); + return this; } /** @@ -256,21 +253,8 @@ public class SourceSet { * @return this operation instance */ public SourceSet classpath(String... files) { - return classpathStrings(List.of(files)); - } - - /** - * 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. - * - * @param files one or more file - * @return this operation instance - */ - public SourceSet classpath(Path... files) { - return classpathPaths(List.of(files)); + classpath_.addAll(Arrays.stream(files).map(File::new).toList()); + return this; } /** @@ -297,36 +281,6 @@ public class SourceSet { return classpath_; } - /** - * 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. - * - * @param files the collection of files - * @return this operation instance - */ - public SourceSet classpathPaths(Collection files) { - classpath_.addAll(files.stream().map(Path::toFile).toList()); - 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. - * - * @param files the collection of files - * @return this operation instance - */ - public SourceSet classpathStrings(Collection files) { - classpath_.addAll(files.stream().map(File::new).toList()); - return this; - } - /** * Sets the names of dependent source sets. * @@ -466,25 +420,10 @@ public class SourceSet { * @return this operation instance */ public SourceSet includes(String... files) { - return includesStrings(List.of(files)); + includes_.addAll(Arrays.stream(files).map(File::new).toList()); + return this; } - /** - * Sets the Markdown files that contain module and package documentation. - *

- * The Markdown files that contain module and package documentation. - *

- * The contents of the specified files are parsed and embedded into documentation as module and package - * descriptions. - * - * @param files one or more files - * @return this operation instance - */ - public SourceSet includes(Path... files) { - return includesPaths(List.of(files)); - } - - /** * Retrieves the Markdown files that contain module and package documentation. * @@ -510,38 +449,6 @@ public class SourceSet { return this; } - /** - * Sets the Markdown files that contain module and package documentation. - *

- * The Markdown files that contain module and package documentation. - *

- * The contents of the specified files are parsed and embedded into documentation as module and package - * descriptions. - * - * @param files the collection of files - * @return this operation instance - */ - public SourceSet includesPaths(Collection files) { - includes_.addAll(files.stream().map(Path::toFile).toList()); - return this; - } - - /** - * Sets the Markdown files that contain module and package documentation. - *

- * The Markdown files that contain module and package documentation. - *

- * The contents of the specified files are parsed and embedded into documentation as module and package - * descriptions. - * - * @param files the collection of files - * @return this operation instance - */ - public SourceSet includesStrings(Collection files) { - includes_.addAll(files.stream().map(File::new).toList()); - return this; - } - /** * Sets the version of JDK to use for linking to JDK Javadocs. *

@@ -558,15 +465,6 @@ public class SourceSet { return this; } - /** - * Retrieves the version of the JDK to use for linking to JDK Javadocs. - * - * @return the JDK version. - */ - public String jdkVersion() { - return jdkVersion_; - } - /** * Sets the version of JDK to use for linking to JDK Javadocs. *

@@ -759,7 +657,8 @@ public class SourceSet { * @return this operation instance */ public SourceSet samples(File... samples) { - return samples(List.of(samples)); + samples_.addAll(List.of(samples)); + return this; } /** @@ -772,47 +671,7 @@ public class SourceSet { * @return this operation instance */ public SourceSet samples(String... samples) { - return samplesStrings(List.of(samples)); - } - - /** - * Set the directories or files that contain sample functions. - *

- * The directories or files that contain sample functions which are referenced via the {@code @sample} KDoc - * tag. - * - * @param samples nne or more samples - * @return this operation instance - */ - public SourceSet samples(Path... samples) { - return samplesPaths(List.of(samples)); - } - - /** - * Set the directories or files that contain sample functions. - *

- * The directories or files that contain sample functions which are referenced via the {@code @sample} KDoc - * tag. - * - * @param samples the samples - * @return this operation instance - */ - public SourceSet samplesPaths(Collection samples) { - samples_.addAll(samples.stream().map(Path::toFile).toList()); - return this; - } - - /** - * Set the directories or files that contain sample functions. - *

- * The directories or files that contain sample functions which are referenced via the {@code @sample} KDoc - * tag. - * - * @param samples the samples - * @return this operation instance - */ - public SourceSet samplesStrings(Collection samples) { - samples_.addAll(samples.stream().map(File::new).toList()); + samples_.addAll(Arrays.stream(samples).map(File::new).toList()); return this; } @@ -866,7 +725,8 @@ public class SourceSet { * @return this operation instance */ public SourceSet src(File... src) { - return src(List.of(src)); + src_.addAll(List.of(src)); + return this; } /** @@ -879,20 +739,8 @@ public class SourceSet { * @return this operation instance */ public SourceSet src(String... src) { - return srcStrings(List.of(src)); - } - - /** - * Sets the source code roots to be analyzed and documented. - *

- * The source code roots to be analyzed and documented. Acceptable inputs are directories and individual - * {@code .kt} / {@code .java} files. - * - * @param src pne ore moe source code roots - * @return this operation instance - */ - public SourceSet src(Path... src) { - return srcPaths(List.of(src)); + src_.addAll(Arrays.stream(src).map(File::new).toList()); + return this; } /** @@ -939,34 +787,6 @@ public class SourceSet { return srcLinks_; } - /** - * Sets the source code roots to be analyzed and documented. - *

- * The source code roots to be analyzed and documented. Acceptable inputs are directories and individual - * {@code .kt} / {@code .java} files. - * - * @param src the source code roots - * @return this operation instance - */ - public SourceSet srcPaths(Collection src) { - src_.addAll(src.stream().map(Path::toFile).toList()); - return this; - } - - /** - * Sets the source code roots to be analyzed and documented. - *

- * The source code roots to be analyzed and documented. Acceptable inputs are directories and individual - * {@code .kt} / {@code .java} files. - * - * @param src the source code roots - * @return this operation instance - */ - public SourceSet srcStrings(Collection src) { - src_.addAll(src.stream().map(File::new).toList()); - return this; - } - /** * Sets the paths to files to be suppressed. *

@@ -980,6 +800,7 @@ public class SourceSet { return this; } + /** * Retrieves the paths to files to be suppressed. * @@ -998,7 +819,8 @@ public class SourceSet { * @return this operation instance */ public SourceSet suppressedFiles(String... suppressedFiles) { - return suppressedFilesStrings(List.of(suppressedFiles)); + suppressedFiles_.addAll(Arrays.stream(suppressedFiles).map(File::new).toList()); + return this; } /** @@ -1010,44 +832,7 @@ public class SourceSet { * @return this operation instance */ public SourceSet suppressedFiles(File... suppressedFiles) { - return suppressedFiles(List.of(suppressedFiles)); - } - - /** - * Sets the paths to files to be suppressed. - *

- * The files to be suppressed when generating documentation. - * - * @param suppressedFiles one or moe suppressed files - * @return this operation instance - */ - public SourceSet suppressedFiles(Path... suppressedFiles) { - return suppressedFilesPaths(List.of(suppressedFiles)); - } - - /** - * Sets the paths to files to be suppressed. - *

- * The files to be suppressed when generating documentation. - * - * @param suppressedFiles the suppressed files - * @return this operation instance - */ - public SourceSet suppressedFilesPaths(Collection suppressedFiles) { - suppressedFiles_.addAll(suppressedFiles.stream().map(Path::toFile).toList()); - return this; - } - - /** - * Sets the paths to files to be suppressed. - *

- * The files to be suppressed when generating documentation. - * - * @param suppressedFiles the suppressed files - * @return this operation instance - */ - public SourceSet suppressedFilesStrings(Collection suppressedFiles) { - suppressedFiles_.addAll(suppressedFiles.stream().map(File::new).toList()); + suppressedFiles_.addAll(List.of(suppressedFiles)); return this; } } diff --git a/src/test/java/rife/bld/extension/DokkaOperationTest.java b/src/test/java/rife/bld/extension/DokkaOperationTest.java index 398fd22..11c2bca 100644 --- a/src/test/java/rife/bld/extension/DokkaOperationTest.java +++ b/src/test/java/rife/bld/extension/DokkaOperationTest.java @@ -27,7 +27,6 @@ import rife.bld.operations.exceptions.ExitStatusException; import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; @@ -182,94 +181,4 @@ class DokkaOperationTest { .outputFormat(OutputFormat.JAVADOC); assertThatCode(op::execute).doesNotThrowAnyException(); } - - @Test - void includesTest() { - var op = new DokkaOperation(); - - op.includes(List.of(new File(FILE_1), new File(FILE_2))); - assertThat(op.includes()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2)); - op.includes().clear(); - - op.includes(new File(FILE_1), new File(FILE_2)); - assertThat(op.includes()).as("File...").containsExactly(new File(FILE_1), new File(FILE_2)); - op.includes().clear(); - - op.includes(FILE_1, FILE_2); - assertThat(op.includes()).as("String...") - .containsExactly(new File(FILE_1), new File(FILE_2)); - op.includes().clear(); - - op = op.includes(Path.of(FILE_1), Path.of(FILE_2)); - assertThat(op.includes()).as("Path...") - .containsExactly(new File(FILE_1), new File(FILE_2)); - op.includes().clear(); - - op.includesPaths(List.of(new File(FILE_1).toPath(), new File(FILE_2).toPath())); - assertThat(op.includes()).as("List(Path...)").containsExactly(new File(FILE_1), new File(FILE_2)); - op.includes().clear(); - - op.includesStrings(List.of(FILE_1, FILE_2)); - assertThat(op.includes()).as("List(String...)").containsExactly(new File(FILE_1), new File(FILE_2)); - op.includes().clear(); - } - - @Test - void jsonTest() { - var file1 = new File(FILE_1); - var op = new DokkaOperation().json(file1); - assertThat(op.json()).isEqualTo(file1); - - var file2 = Path.of(FILE_2); - op = op.json(file2); - assertThat(op.json()).isEqualTo(file2.toFile()); - - op = op.json(FILE_3); - assertThat(op.json()).isEqualTo(new File(FILE_3)); - } - - @Test - void outputDirTest() { - var javadoc = "build/javadoc"; - var op = new DokkaOperation().outputDir(javadoc); - assertThat(op.outputDir()).isEqualTo(new File(javadoc)); - - var build = "build"; - op = op.outputDir(Path.of(build)); - assertThat(op.outputDir()).isEqualTo(new File(build)); - - op = op.outputDir(new File(javadoc)); - assertThat(op.outputDir()).isEqualTo(new File(javadoc)); - } - - @Test - void pluginClasspathTest() { - var op = new DokkaOperation(); - - op.pluginsClasspath(List.of(new File(FILE_1), new File(FILE_2))); - assertThat(op.pluginsClasspath()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2)); - op.pluginsClasspath().clear(); - - op.pluginsClasspath(new File(FILE_1), new File(FILE_2)); - assertThat(op.pluginsClasspath()).as("File...").containsExactly(new File(FILE_1), new File(FILE_2)); - op.pluginsClasspath().clear(); - - op.pluginsClasspath(FILE_1, FILE_2); - assertThat(op.pluginsClasspath()).as("String...") - .containsExactly(new File(FILE_1), new File(FILE_2)); - op.pluginsClasspath().clear(); - - op = op.pluginsClasspath(Path.of(FILE_1), Path.of(FILE_2)); - assertThat(op.pluginsClasspath()).as("Path...") - .containsExactly(new File(FILE_1), new File(FILE_2)); - op.pluginsClasspath().clear(); - - op.pluginsClasspathPaths(List.of(new File(FILE_1).toPath(), new File(FILE_2).toPath())); - assertThat(op.pluginsClasspath()).as("List(Path...)").containsExactly(new File(FILE_1), new File(FILE_2)); - op.pluginsClasspath().clear(); - - op.pluginsClasspathStrings(List.of(FILE_1, FILE_2)); - assertThat(op.pluginsClasspath()).as("List(String...)").containsExactly(new File(FILE_1), new File(FILE_2)); - op.pluginsClasspath().clear(); - } } diff --git a/src/test/java/rife/bld/extension/dokka/SourceSetTest.java b/src/test/java/rife/bld/extension/dokka/SourceSetTest.java index 031a818..95453c4 100644 --- a/src/test/java/rife/bld/extension/dokka/SourceSetTest.java +++ b/src/test/java/rife/bld/extension/dokka/SourceSetTest.java @@ -21,7 +21,6 @@ import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import java.util.Map; @@ -30,7 +29,6 @@ import java.util.stream.IntStream; import static org.assertj.core.api.Assertions.assertThat; import static rife.bld.extension.TestUtils.localPath; -@SuppressWarnings("PMD.AvoidDuplicateLiterals") class SourceSetTest { private static final String CLASSPATH_1 = "classpath1"; private static final String CLASSPATH_2 = "classpath2"; @@ -53,104 +51,6 @@ class SourceSetTest { private static final String SUP_2 = "sup2"; private static final String SUP_3 = "sup3"; - @Test - void classpathTest() { - var args = new SourceSet(); - - args.classpath(new File(CLASSPATH_1), new File(CLASSPATH_2)); - assertThat(args.classpath()).as("File...").containsExactly(new File(CLASSPATH_1), new File(CLASSPATH_2)); - args.classpath().clear(); - - args = args.classpath(Path.of(CLASSPATH_1), Path.of(CLASSPATH_2)); - assertThat(args.classpath()).as("Path...") - .containsExactly(new File(CLASSPATH_1), new File(CLASSPATH_2)); - args.classpath().clear(); - - args.classpath(CLASSPATH_1, CLASSPATH_2); - assertThat(args.classpath()).as("String...") - .containsExactly(new File(CLASSPATH_1), new File(CLASSPATH_2)); - args.classpath().clear(); - - args.classpath(List.of(new File(CLASSPATH_1), new File(CLASSPATH_2))); - assertThat(args.classpath()).as("File(List...)").containsExactly(new File(CLASSPATH_1), new File(CLASSPATH_2)); - args.classpath().clear(); - - args.classpathPaths(List.of(new File(CLASSPATH_1).toPath(), new File(CLASSPATH_2).toPath())); - assertThat(args.classpath()).as("List(Path...)").containsExactly(new File(CLASSPATH_1), new File(CLASSPATH_2)); - args.classpath().clear(); - - args.classpathStrings(List.of(CLASSPATH_1, CLASSPATH_2)); - assertThat(args.classpath()).as("List(String...)").containsExactly(new File(CLASSPATH_1), new File(CLASSPATH_2)); - args.classpath().clear(); - } - - @Test - void includesTest() { - var args = new SourceSet(); - - args.includes(new File(INCLUDES_1), new File(INCLUDES_2)); - assertThat(args.includes()).as("File...").containsExactly(new File(INCLUDES_1), new File(INCLUDES_2)); - args.includes().clear(); - - args = args.includes(Path.of(INCLUDES_1), Path.of(INCLUDES_2)); - assertThat(args.includes()).as("Path...").containsExactly(new File(INCLUDES_1), new File(INCLUDES_2)); - args.includes().clear(); - - args.includes(INCLUDES_1, INCLUDES_2); - assertThat(args.includes()).as("String...").containsExactly(new File(INCLUDES_1), new File(INCLUDES_2)); - args.includes().clear(); - - args.includes(List.of(new File(INCLUDES_1), new File(INCLUDES_2))); - assertThat(args.includes()).as("List(File...)").containsExactly(new File(INCLUDES_1), new File(INCLUDES_2)); - args.includes().clear(); - - args.includesPaths(List.of(new File(INCLUDES_1).toPath(), new File(INCLUDES_2).toPath())); - assertThat(args.includes()).as("List(Path...)").containsExactly(new File(INCLUDES_1), new File(INCLUDES_2)); - args.includes().clear(); - - args.includesStrings(List.of(INCLUDES_1, INCLUDES_2)); - assertThat(args.includes()).as("List(String...)").containsExactly(new File(INCLUDES_1), new File(INCLUDES_2)); - args.includes().clear(); - } - - @Test - void jdkVersionTest() { - var args = new SourceSet().jdkVersion("22"); - assertThat(args.jdkVersion()).isEqualTo("22"); - args = args.jdkVersion(19); - assertThat(args.jdkVersion()).isEqualTo("19"); - } - - @Test - void samplesTest() { - var args = new SourceSet(); - args.samples(new File(SAMPLES_1), new File(SAMPLES_2)); - assertThat(args.samples()).as("File...").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.samples().clear(); - - args = args.samples(Path.of(SAMPLES_1), Path.of(SAMPLES_2)); - assertThat(args.samples()).as("Path...") - .containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.samples().clear(); - - args.samples(SAMPLES_1, SAMPLES_2); - assertThat(args.samples()).as("String...") - .containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.samples().clear(); - - args.samples(List.of(new File(SAMPLES_1), new File(SAMPLES_2))); - assertThat(args.samples()).as("List(File...)").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.samples().clear(); - - args.samplesPaths(List.of(new File(SAMPLES_1).toPath(), new File(SAMPLES_2).toPath())); - assertThat(args.samples()).as("List(Path...)").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.samples().clear(); - - args.samplesStrings(List.of(SAMPLES_1, SAMPLES_2)); - assertThat(args.samples()).as("List(String...)").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.samples().clear(); - } - @Test void sourceSetCollectionsTest() { var args = new SourceSet() @@ -279,67 +179,4 @@ class SourceSetTest { IntStream.range(0, params.size()).forEach(i -> assertThat(params.get(i)).isEqualTo(matches.get(i))); } - - @Test - void srcTest() { - var src = "src"; - var main = "src/main"; - var test = "src/test"; - var srcFile = new File(src); - var mainFile = new File(main); - var testFile = new File(test); - - var args = new SourceSet().src(src, main); - assertThat(args.src()).as("String...").containsExactly(srcFile, mainFile); - args.src().clear(); - - args = new SourceSet().srcStrings(List.of(src, main)); - assertThat(args.src()).as("List(String...)").containsExactly(srcFile, mainFile); - args.src().clear(); - - args = args.src(srcFile.toPath(), mainFile.toPath()); - assertThat(args.src()).as("Path...").containsExactly(srcFile, mainFile); - args.src().clear(); - - args = args.srcPaths(List.of(srcFile.toPath(), testFile.toPath())); - assertThat(args.src()).as("List(Path...)").containsExactly(srcFile, testFile); - args.src().clear(); - - args = args.src(srcFile, mainFile); - assertThat(args.src()).as("File...").containsExactly(srcFile, mainFile); - args.src().clear(); - - args = args.src(List.of(srcFile, mainFile)); - assertThat(args.src()).as("List(File...)").containsExactly(srcFile, mainFile); - args.src().clear(); - } - - @Test - void suppressedFilesTest() { - var args = new SourceSet(); - - args.suppressedFiles(new File(SAMPLES_1), new File(SAMPLES_2)); - assertThat(args.suppressedFiles()).as("File...").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.suppressedFiles().clear(); - - args = args.suppressedFiles(Path.of(SAMPLES_1), Path.of(SAMPLES_2)); - assertThat(args.suppressedFiles()).as("Path...").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.suppressedFiles().clear(); - - args.suppressedFiles(SAMPLES_1, SAMPLES_2); - assertThat(args.suppressedFiles()).as("String...").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.suppressedFiles().clear(); - - args.suppressedFiles(List.of(new File(SAMPLES_1), new File(SAMPLES_2))); - assertThat(args.suppressedFiles()).as("List(File...)").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.suppressedFiles().clear(); - - args.suppressedFilesPaths(List.of(new File(SAMPLES_1).toPath(), new File(SAMPLES_2).toPath())); - assertThat(args.suppressedFiles()).as("List(Path...)").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.suppressedFiles().clear(); - - args.suppressedFilesStrings(List.of(SAMPLES_1, SAMPLES_2)); - assertThat(args.suppressedFiles()).as("List(String...)").containsExactly(new File(SAMPLES_1), new File(SAMPLES_2)); - args.suppressedFiles().clear(); - } }