Cleaned up API to match bld operations and options APIs

This commit is contained in:
Erik C. Thauvin 2024-08-27 10:11:08 -07:00
parent 7b6e75d44c
commit f340aed106
Signed by: erik
GPG key ID: 776702A6A2DA330E
5 changed files with 284 additions and 41 deletions

View file

@ -22,6 +22,7 @@ import rife.tools.FileUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -151,6 +152,16 @@ public class BootWarOperation extends AbstractBootOperation<BootWarOperation> {
return this;
}
/**
* Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
* @param jars one or more Java archive files
* @return this operation instance
*/
public BootWarOperation providedLibs(String... jars) {
return providedLibsStrings(List.of(jars));
}
/**
* Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
@ -158,7 +169,47 @@ public class BootWarOperation extends AbstractBootOperation<BootWarOperation> {
* @return this operation instance
*/
public BootWarOperation providedLibs(File... jars) {
providedLibs_.addAll(List.of(jars));
return providedLibs(List.of(jars));
}
/**
* Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
* @param jars one or more Java archive files
* @return this operation instance
*/
public BootWarOperation providedLibs(Path... jars) {
return providedLibsPaths(List.of(jars));
}
/**
* Retrieves the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
* @return the list of Java archive files.
*/
public List<File> providedLibs() {
return providedLibs_;
}
/**
* Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
* @param jars one or more Java archive files
* @return this operation instance
*/
public BootWarOperation providedLibsPaths(Collection<Path> jars) {
providedLibs_.addAll(jars.stream().map(Path::toFile).toList());
return this;
}
/**
* Provides the libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
* @param jars one or more Java archive files
* @return this operation instance
*/
public BootWarOperation providedLibsStrings(Collection<String> jars) {
providedLibs_.addAll(jars.stream().map(File::new).toList());
return this;
}
}