Skip to content

Commit

Permalink
More API cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed Aug 30, 2024
1 parent b8e4cc9 commit 80ea834
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
30 changes: 18 additions & 12 deletions src/main/java/rife/bld/extension/DokkaOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ public DokkaOperation globalLinks(Map<String, String> globalLinks) {
* @return this operation instance
*/
public DokkaOperation globalPackageOptions(String... options) {
globalPackageOptions_.addAll(List.of(options));
return this;
return globalPackageOptions(List.of(options));
}

/**
Expand Down Expand Up @@ -415,8 +414,7 @@ public DokkaOperation globalPackageOptions(Collection<String> options) {
* @return this operation instance
*/
public DokkaOperation globalSrcLink(String... links) {
globalSrcLinks_.addAll(List.of(links));
return this;
return globalSrcLink(List.of(links));
}

/**
Expand Down Expand Up @@ -448,6 +446,7 @@ public DokkaOperation globalSrcLink(Collection<String> links) {
*
* @param files one or more files
* @return this operation instance
* @see #includes(Collection)
*/
public DokkaOperation includes(File... files) {
return includes(List.of(files));
Expand All @@ -462,6 +461,7 @@ public DokkaOperation includes(File... files) {
*
* @param files one or more files
* @return this operation instance
* @see #includesStrings(Collection)
*/
public DokkaOperation includes(String... files) {
return includesStrings(List.of(files));
Expand All @@ -476,6 +476,7 @@ public DokkaOperation includes(String... files) {
*
* @param files one or more files
* @return this operation instance
* @see #includesPaths(Collection)
*/
public DokkaOperation includes(Path... files) {
return includesPaths(List.of(files));
Expand All @@ -500,6 +501,7 @@ public Collection<File> includes() {
*
* @param files the markdown files
* @return this operation instance
* @see #includes(File...)
*/
public DokkaOperation includes(Collection<File> files) {
includes_.addAll(files);
Expand All @@ -515,10 +517,10 @@ public DokkaOperation includes(Collection<File> files) {
*
* @param files the markdown files
* @return this operation instance
* @see #includes(Path...)
*/
public DokkaOperation includesPaths(Collection<Path> files) {
includes_.addAll(files.stream().map(Path::toFile).toList());
return this;
return includes(files.stream().map(Path::toFile).toList());
}

/**
Expand All @@ -530,10 +532,10 @@ public DokkaOperation includesPaths(Collection<Path> files) {
*
* @param files the markdown files
* @return this operation instance
* @see #includes(String...)
*/
public DokkaOperation includesStrings(Collection<String> files) {
includes_.addAll(files.stream().map(File::new).toList());
return this;
return includes(files.stream().map(File::new).toList());
}

/**
Expand Down Expand Up @@ -758,6 +760,7 @@ public Map<String, String> pluginConfigurations() {
*
* @param jars one or more jars
* @return this operation instance
* @see #includes(Collection)
*/
public DokkaOperation pluginsClasspath(File... jars) {
return pluginsClasspath(List.of(jars));
Expand All @@ -768,6 +771,7 @@ public DokkaOperation pluginsClasspath(File... jars) {
*
* @param jars one or more jars
* @return this operation instance
* @see #pluginsClasspathStrings(Collection)
*/
public DokkaOperation pluginsClasspath(String... jars) {
return pluginsClasspathStrings(List.of(jars));
Expand All @@ -778,6 +782,7 @@ public DokkaOperation pluginsClasspath(String... jars) {
*
* @param jars one or more jars
* @return this operation instance
* @see #pluginsClasspathPaths(Collection)
*/
public DokkaOperation pluginsClasspath(Path... jars) {
return pluginsClasspathPaths(List.of(jars));
Expand All @@ -797,6 +802,7 @@ public Collection<File> pluginsClasspath() {
*
* @param jars the jars
* @return this operation instance
* @see #pluginsClasspath(Collection)
*/
public DokkaOperation pluginsClasspath(Collection<File> jars) {
pluginsClasspath_.addAll(jars);
Expand All @@ -808,21 +814,21 @@ public DokkaOperation pluginsClasspath(Collection<File> jars) {
*
* @param jars the jars
* @return this operation instance
* @see #pluginsClasspath(Path...)
*/
public DokkaOperation pluginsClasspathPaths(Collection<Path> jars) {
pluginsClasspath_.addAll(jars.stream().map(Path::toFile).toList());
return this;
return pluginsClasspath(jars.stream().map(Path::toFile).toList());
}

/**
* Sets the jars for Dokka plugins and their dependencies.
*
* @param jars the jars
* @return this operation instance
* @see #pluginsClasspath(String...)
*/
public DokkaOperation pluginsClasspathStrings(Collection<String> jars) {
pluginsClasspath_.addAll(jars.stream().map(File::new).toList());
return this;
return pluginsClasspath(jars.stream().map(File::new).toList());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/rife/bld/extension/DokkaOperationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void outputDirTest() {
@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();
Expand Down

0 comments on commit 80ea834

Please sign in to comment.