Cleaned up API to match bld operations and options APIs
Some checks failed
bld-ci / build-bld-project (17, 1.19.24) (push) Has been cancelled
bld-ci / build-bld-project (17, 2.0.0) (push) Has been cancelled
bld-ci / build-bld-project (21, 1.19.24) (push) Has been cancelled
bld-ci / build-bld-project (21, 2.0.0) (push) Has been cancelled
bld-ci / build-bld-project (22, 1.19.24) (push) Has been cancelled
bld-ci / build-bld-project (22, 2.0.0) (push) Has been cancelled
javadocs-pages / deploy (push) Has been cancelled

This commit is contained in:
Erik C. Thauvin 2024-08-27 23:20:08 -07:00
parent fdee1781b5
commit 61d41e2fbe
Signed by: erik
GPG key ID: 776702A6A2DA330E
8 changed files with 634 additions and 44 deletions

View file

@ -26,7 +26,11 @@ import rife.tools.StringUtils;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -446,8 +450,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation includes(File... files) {
includes_.addAll(List.of(files));
return this;
return includes(List.of(files));
}
/**
@ -461,10 +464,24 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation includes(String... files) {
includes_.addAll(Arrays.stream(files).map(File::new).toList());
return this;
return includesStrings(List.of(files));
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* The contents of specified files are parsed and embedded into documentation as module and package descriptions.
* <p>
* 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.
*
@ -489,6 +506,36 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
return this;
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* The contents of specified files are parsed and embedded into documentation as module and package descriptions.
* <p>
* This can be configured on per-package basis.
*
* @param files the markdown files
* @return this operation instance
*/
public DokkaOperation includesPaths(Collection<Path> files) {
includes_.addAll(files.stream().map(Path::toFile).toList());
return this;
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* The contents of specified files are parsed and embedded into documentation as module and package descriptions.
* <p>
* This can be configured on per-package basis.
*
* @param files the markdown files
* @return this operation instance
*/
public DokkaOperation includesStrings(Collection<String> files) {
includes_.addAll(files.stream().map(File::new).toList());
return this;
}
/**
* JSON configuration file path.
*
@ -499,6 +546,33 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
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.
*
@ -589,6 +663,15 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
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.
* <p>
@ -598,8 +681,19 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation outputDir(String outputDir) {
outputDir_ = new File(outputDir);
return this;
return outputDir(new File(outputDir));
}
/**
* Sets the output directory path, {@code ./dokka} by default.
* <p>
* 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());
}
/**
@ -641,12 +735,12 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
/**
* Sets the configuration for Dokka plugins.
*
* @param pluginConfiguratione the map of configurations
* @param pluginConfigurations the map of configurations
* @return this operation instance
* @see #pluginConfigurations(String, String)
*/
public DokkaOperation pluginConfigurations(Map<String, String> pluginConfiguratione) {
pluginsConfiguration_.putAll(pluginConfiguratione);
public DokkaOperation pluginConfigurations(Map<String, String> pluginConfigurations) {
pluginsConfiguration_.putAll(pluginConfigurations);
return this;
}
@ -666,8 +760,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation pluginsClasspath(File... jars) {
pluginsClasspath_.addAll(List.of(jars));
return this;
return pluginsClasspath(List.of(jars));
}
/**
@ -677,8 +770,17 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation pluginsClasspath(String... jars) {
pluginsClasspath_.addAll(Arrays.stream(jars).map(File::new).toList());
return this;
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));
}
/**
@ -701,6 +803,28 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
return this;
}
/**
* Sets the jars for Dokka plugins and their dependencies.
*
* @param jars the jars
* @return this operation instance
*/
public DokkaOperation pluginsClasspathPaths(Collection<Path> 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<String> jars) {
pluginsClasspath_.addAll(jars.stream().map(File::new).toList());
return this;
}
/**
* Sets the configurations for a source set.
* <p>

View file

@ -19,7 +19,11 @@ package rife.bld.extension.dokka;
import rife.bld.extension.DokkaOperation;
import java.io.File;
import java.util.*;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@ -238,8 +242,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet classpath(File... files) {
classpath_.addAll(List.of(files));
return this;
return classpath(List.of(files));
}
/**
@ -253,8 +256,21 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet classpath(String... files) {
classpath_.addAll(Arrays.stream(files).map(File::new).toList());
return this;
return classpathStrings(List.of(files));
}
/**
* Sets classpath for analysis and interactive samples.
* <p>
* This is useful if some types that come from dependencies are not resolved/picked up automatically.
* <p>
* 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));
}
/**
@ -281,6 +297,36 @@ public class SourceSet {
return classpath_;
}
/**
* Sets classpath for analysis and interactive samples.
* <p>
* This is useful if some types that come from dependencies are not resolved/picked up automatically.
* <p>
* This option accepts both {@code .jar} and {@code .klib} files.
*
* @param files the collection of files
* @return this operation instance
*/
public SourceSet classpathPaths(Collection<Path> files) {
classpath_.addAll(files.stream().map(Path::toFile).toList());
return this;
}
/**
* Sets classpath for analysis and interactive samples.
* <p>
* This is useful if some types that come from dependencies are not resolved/picked up automatically.
* <p>
* This option accepts both {@code .jar} and {@code .klib} files.
*
* @param files the collection of files
* @return this operation instance
*/
public SourceSet classpathStrings(Collection<String> files) {
classpath_.addAll(files.stream().map(File::new).toList());
return this;
}
/**
* Sets the names of dependent source sets.
*
@ -420,10 +466,25 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet includes(String... files) {
includes_.addAll(Arrays.stream(files).map(File::new).toList());
return this;
return includesStrings(List.of(files));
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* The Markdown files that contain module and package documentation.
* <p>
* 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.
*
@ -449,6 +510,38 @@ public class SourceSet {
return this;
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* The Markdown files that contain module and package documentation.
* <p>
* 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<Path> files) {
includes_.addAll(files.stream().map(Path::toFile).toList());
return this;
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* The Markdown files that contain module and package documentation.
* <p>
* 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<String> files) {
includes_.addAll(files.stream().map(File::new).toList());
return this;
}
/**
* Sets the version of JDK to use for linking to JDK Javadocs.
* <p>
@ -465,6 +558,15 @@ 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.
* <p>
@ -657,8 +759,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet samples(File... samples) {
samples_.addAll(List.of(samples));
return this;
return samples(List.of(samples));
}
/**
@ -671,7 +772,47 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet samples(String... samples) {
samples_.addAll(Arrays.stream(samples).map(File::new).toList());
return samplesStrings(List.of(samples));
}
/**
* Set the directories or files that contain sample functions.
* <p>
* 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.
* <p>
* 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<Path> samples) {
samples_.addAll(samples.stream().map(Path::toFile).toList());
return this;
}
/**
* Set the directories or files that contain sample functions.
* <p>
* 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<String> samples) {
samples_.addAll(samples.stream().map(File::new).toList());
return this;
}
@ -725,8 +866,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet src(File... src) {
src_.addAll(List.of(src));
return this;
return src(List.of(src));
}
/**
@ -739,8 +879,20 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet src(String... src) {
src_.addAll(Arrays.stream(src).map(File::new).toList());
return this;
return srcStrings(List.of(src));
}
/**
* Sets the source code roots to be analyzed and documented.
* <p>
* 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));
}
/**
@ -787,6 +939,34 @@ public class SourceSet {
return srcLinks_;
}
/**
* Sets the source code roots to be analyzed and documented.
* <p>
* 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<Path> src) {
src_.addAll(src.stream().map(Path::toFile).toList());
return this;
}
/**
* Sets the source code roots to be analyzed and documented.
* <p>
* 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<String> src) {
src_.addAll(src.stream().map(File::new).toList());
return this;
}
/**
* Sets the paths to files to be suppressed.
* <p>
@ -800,7 +980,6 @@ public class SourceSet {
return this;
}
/**
* Retrieves the paths to files to be suppressed.
*
@ -819,8 +998,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet suppressedFiles(String... suppressedFiles) {
suppressedFiles_.addAll(Arrays.stream(suppressedFiles).map(File::new).toList());
return this;
return suppressedFilesStrings(List.of(suppressedFiles));
}
/**
@ -832,7 +1010,44 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet suppressedFiles(File... suppressedFiles) {
suppressedFiles_.addAll(List.of(suppressedFiles));
return suppressedFiles(List.of(suppressedFiles));
}
/**
* Sets the paths to files to be suppressed.
* <p>
* 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.
* <p>
* The files to be suppressed when generating documentation.
*
* @param suppressedFiles the suppressed files
* @return this operation instance
*/
public SourceSet suppressedFilesPaths(Collection<Path> suppressedFiles) {
suppressedFiles_.addAll(suppressedFiles.stream().map(Path::toFile).toList());
return this;
}
/**
* Sets the paths to files to be suppressed.
* <p>
* The files to be suppressed when generating documentation.
*
* @param suppressedFiles the suppressed files
* @return this operation instance
*/
public SourceSet suppressedFilesStrings(Collection<String> suppressedFiles) {
suppressedFiles_.addAll(suppressedFiles.stream().map(File::new).toList());
return this;
}
}