diff --git a/src/main/java/rife/bld/operations/JlinkOptions.java b/src/main/java/rife/bld/operations/JlinkOptions.java index f358ad1..425482e 100644 --- a/src/main/java/rife/bld/operations/JlinkOptions.java +++ b/src/main/java/rife/bld/operations/JlinkOptions.java @@ -173,8 +173,7 @@ public JlinkOptions modulePath(String path) { * @return this map of options */ public JlinkOptions modulePath(File path) { - put("--module-path", path.getAbsolutePath()); - return this; + return modulePath(path.getAbsolutePath()); } /** @@ -187,8 +186,7 @@ public JlinkOptions modulePath(File path) { * @return this map of options */ public JlinkOptions modulePath(Path path) { - put("--module-path", path.toFile().getAbsolutePath()); - return this; + return modulePath(path.toFile()); } /** @@ -239,8 +237,7 @@ public JlinkOptions output(String path) { * @return this map of options */ public JlinkOptions output(File path) { - put("--output", path.getAbsolutePath()); - return this; + return output(path.getAbsolutePath()); } /** @@ -250,8 +247,7 @@ public JlinkOptions output(File path) { * @return this map of options */ public JlinkOptions output(Path path) { - put("--output", path.toFile().getAbsolutePath()); - return this; + return output(path.toFile()); } /** diff --git a/src/main/java/rife/bld/operations/JmodOptions.java b/src/main/java/rife/bld/operations/JmodOptions.java index d85a5eb..668163e 100644 --- a/src/main/java/rife/bld/operations/JmodOptions.java +++ b/src/main/java/rife/bld/operations/JmodOptions.java @@ -49,8 +49,7 @@ public JmodOptions cmds(String path) { */ @SuppressWarnings("UnusedReturnValue") public JmodOptions cmds(File path) { - put("--cmds", path.getAbsolutePath()); - return this; + return cmds(path.getAbsolutePath()); } /** @@ -60,8 +59,7 @@ public JmodOptions cmds(File path) { * @return this map of options */ public JmodOptions cmds(Path path) { - put("--cmds", path.toFile().getAbsolutePath()); - return this; + return cmds(path.toFile()); } /** @@ -101,8 +99,7 @@ public JmodOptions config(String path) { * @return this map of options */ public JmodOptions config(File path) { - put("--config", path.getAbsolutePath()); - return this; + return config(path.getAbsolutePath()); } /** @@ -112,8 +109,7 @@ public JmodOptions config(File path) { * @return this map of options */ public JmodOptions config(Path path) { - put("--config", path.toFile().getAbsolutePath()); - return this; + return config(path.toFile()); } /** @@ -145,8 +141,7 @@ public JmodOptions dir(String path) { * @return this map of options */ public JmodOptions dir(File path) { - put("--dir", path.getAbsolutePath()); - return this; + return dir(path.getAbsolutePath()); } /** @@ -156,8 +151,7 @@ public JmodOptions dir(File path) { * @return this map of options */ public JmodOptions dir(Path path) { - put("--dir", path.toFile().getAbsolutePath()); - return this; + return dir(path.toFile()); } /** @@ -241,8 +235,7 @@ public JmodOptions headerFiles(String path) { */ @SuppressWarnings("UnusedReturnValue") public JmodOptions headerFiles(File path) { - put("--header-files", path.getAbsolutePath()); - return this; + return headerFiles(path.getAbsolutePath()); } /** @@ -252,8 +245,7 @@ public JmodOptions headerFiles(File path) { * @return this map of options */ public JmodOptions headerFiles(Path path) { - put("--header-files", path.toFile().getAbsolutePath()); - return this; + return headerFiles(path.toFile()); } /** @@ -275,8 +267,7 @@ public JmodOptions legalNotices(String path) { */ @SuppressWarnings("UnusedReturnValue") public JmodOptions legalNotices(File path) { - put("--legal-notices", path.getAbsolutePath()); - return this; + return legalNotices(path.getAbsolutePath()); } /** @@ -286,8 +277,7 @@ public JmodOptions legalNotices(File path) { * @return this map of options */ public JmodOptions legalNotices(Path path) { - put("--legal-notices", path.toFile().getAbsolutePath()); - return this; + return legalNotices(path.toFile()); } /** @@ -309,8 +299,7 @@ public JmodOptions libs(String path) { */ @SuppressWarnings("UnusedReturnValue") public JmodOptions libs(File path) { - put("--libs", path.getAbsolutePath()); - return this; + return libs(path.getAbsolutePath()); } /** @@ -320,8 +309,7 @@ public JmodOptions libs(File path) { * @return this map of options */ public JmodOptions libs(Path path) { - put("--libs", path.toFile().getAbsolutePath()); - return this; + return libs(path.toFile()); } /** @@ -354,8 +342,7 @@ public JmodOptions manPages(String path) { */ @SuppressWarnings("UnusedReturnValue") public JmodOptions manPages(File path) { - put("--man-pages", path.getAbsolutePath()); - return this; + return manPages(path.getAbsolutePath()); } /** @@ -365,8 +352,7 @@ public JmodOptions manPages(File path) { * @return this map of options */ public JmodOptions manPages(Path path) { - put("--man-pages", path.toFile().getAbsolutePath()); - return this; + return manPages(path.toFile()); } /** @@ -387,8 +373,7 @@ public JmodOptions modulePath(String path) { * @return this map of options */ public JmodOptions modulePath(File path) { - put("--module-path", path.getAbsolutePath()); - return this; + return modulePath(path.getAbsolutePath()); } /** @@ -398,8 +383,7 @@ public JmodOptions modulePath(File path) { * @return this map of options */ public JmodOptions modulePath(Path path) { - put("--module-path", path.toFile().getAbsolutePath()); - return this; + return modulePath(path.toFile()); } /** diff --git a/src/main/java/rife/bld/operations/JpackageOptions.java b/src/main/java/rife/bld/operations/JpackageOptions.java index e4e40e3..0e6412c 100644 --- a/src/main/java/rife/bld/operations/JpackageOptions.java +++ b/src/main/java/rife/bld/operations/JpackageOptions.java @@ -8,6 +8,7 @@ import java.nio.file.Path; import java.util.Arrays; import java.util.HashMap; +import java.util.List; /** * Options for jpackage tool. @@ -74,8 +75,7 @@ public JpackageOptions appImage(String path) { * @return this map of options */ public JpackageOptions appImage(File path) { - put("--app-image", path.getAbsolutePath()); - return this; + return appImage(path.getAbsolutePath()); } /** @@ -86,8 +86,7 @@ public JpackageOptions appImage(File path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions appImage(Path path) { - put("--app-image", path.toFile().getAbsolutePath()); - return this; + return appImage(path.toFile()); } /** @@ -157,8 +156,7 @@ public JpackageOptions dest(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions dest(File path) { - put("--dest", path.getAbsolutePath()); - return this; + return dest(path.getAbsolutePath()); } /** @@ -170,8 +168,7 @@ public JpackageOptions dest(File path) { * @return this map of options */ public JpackageOptions dest(Path path) { - put("--dest", path.toFile().getAbsolutePath()); - return this; + return dest(path.toFile()); } /** @@ -180,11 +177,24 @@ public JpackageOptions dest(Path path) { * The keys {@code extension}, {@code mime-type}, {@code icon}, and {@code description} can be used to describe the * association. * - * @param path absolute path or relative to the current directory + * @param paths absolute paths or relative to the current directory * @return this map of options */ - public JpackageOptions fileAssociations(String... path) { - put("--file-associations", String.join(",", path)); + public JpackageOptions fileAssociations(String... paths) { + return fileAssociationsStrings(List.of(paths)); + } + + /** + * Path to a Properties file that contains list of key, value pairs. + *

+ * The keys {@code extension}, {@code mime-type}, {@code icon}, and {@code description} can be used to describe the + * association. + * + * @param paths absolute paths or relative to the current directory + * @return this map of options + */ + public JpackageOptions fileAssociationsStrings(List paths) { + put("--file-associations", String.join(",", paths)); return this; } @@ -194,13 +204,12 @@ public JpackageOptions fileAssociations(String... path) { * The keys {@code extension}, {@code mime-type}, {@code icon}, and {@code description} can be used to describe the * association. * - * @param path absolute path or relative to the current directory + * @param paths absolute path or relative to the current directory * @return this map of options */ @SuppressWarnings("UnusedReturnValue") - public JpackageOptions fileAssociations(File... path) { - put("--file-associations", String.join(",", Arrays.stream(path).map(File::getAbsolutePath).toList())); - return this; + public JpackageOptions fileAssociations(File... paths) { + return fileAssociations(List.of(paths)); } /** @@ -209,13 +218,37 @@ public JpackageOptions fileAssociations(File... path) { * The keys {@code extension}, {@code mime-type}, {@code icon}, and {@code description} can be used to describe the * association. * - * @param path absolute path or relative to the current directory + * @param paths absolute path or relative to the current directory * @return this map of options */ - public JpackageOptions fileAssociations(Path... path) { - put("--file-associations", String.join(",", - Arrays.stream(path).map(Path::toFile).map(File::getAbsolutePath).toList())); - return this; + public JpackageOptions fileAssociations(List paths) { + return fileAssociationsStrings(paths.stream().map(File::getAbsolutePath).toList()); + } + + /** + * Path to a Properties file that contains list of key, value pairs. + *

+ * The keys {@code extension}, {@code mime-type}, {@code icon}, and {@code description} can be used to describe the + * association. + * + * @param paths absolute paths or relative to the current directory + * @return this map of options + */ + public JpackageOptions fileAssociations(Path... paths) { + return fileAssociationsPaths(List.of(paths)); + } + + /** + * Path to a Properties file that contains list of key, value pairs. + *

+ * The keys {@code extension}, {@code mime-type}, {@code icon}, and {@code description} can be used to describe the + * association. + * + * @param paths absolute paths or relative to the current directory + * @return this map of options + */ + public JpackageOptions fileAssociationsPaths(List paths) { + return fileAssociations(paths.stream().map(Path::toFile).toList()); } /** @@ -237,8 +270,7 @@ public JpackageOptions icon(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions icon(File path) { - put("--icon", path.getAbsolutePath()); - return this; + return icon(path.getAbsolutePath()); } /** @@ -248,8 +280,7 @@ public JpackageOptions icon(File path) { * @return this map of options */ public JpackageOptions icon(Path path) { - put("--icon", path.toFile().getAbsolutePath()); - return this; + return icon(path.toFile()); } /** @@ -274,8 +305,7 @@ public JpackageOptions input(String path) { * @return this map of options */ public JpackageOptions input(File path) { - put("--input", path.getAbsolutePath()); - return this; + return input(path.getAbsolutePath()); } /** @@ -287,8 +317,7 @@ public JpackageOptions input(File path) { * @return this map of options */ public JpackageOptions input(Path path) { - put("--input", path.toFile().getAbsolutePath()); - return this; + return input(path.toFile()); } /** @@ -310,8 +339,7 @@ public JpackageOptions installDir(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions installDir(File path) { - put("--install-dir", path.getAbsolutePath()); - return this; + return installDir(path.getAbsolutePath()); } /** @@ -321,8 +349,7 @@ public JpackageOptions installDir(File path) { * @return this map of options */ public JpackageOptions installDir(Path path) { - put("--install-dir", path.toFile().getAbsolutePath()); - return this; + return installDir(path.toFile()); } /** @@ -388,8 +415,7 @@ public JpackageOptions licenseFile(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions licenseFile(File path) { - put("--license-file", path.getAbsolutePath()); - return this; + return licenseFile(path.getAbsolutePath()); } /** @@ -399,8 +425,7 @@ public JpackageOptions licenseFile(File path) { * @return this map of options */ public JpackageOptions licenseFile(Path path) { - put("--license-file", path.toFile().getAbsolutePath()); - return this; + return licenseFile(path.toFile()); } /** @@ -598,8 +623,7 @@ public JpackageOptions macEntitlements(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions macEntitlements(File path) { - put("--mac-entitlements", path.getAbsolutePath()); - return this; + return macEntitlements(path.getAbsolutePath()); } /** @@ -609,8 +633,7 @@ public JpackageOptions macEntitlements(File path) { * @return this map of options */ public JpackageOptions macEntitlements(Path path) { - put("--mac-entitlements", path.toFile().getAbsolutePath()); - return this; + return macEntitlements(path.toFile()); } /** @@ -792,12 +815,11 @@ public JpackageOptions module(String name, String mainClass) { *

* Each path is absolute or relative to the current directory. * - * @param path one or more path + * @param paths one or more path * @return this map of options */ - public JpackageOptions modulePath(String... path) { - put("--module-path", String.join(":", path)); - return this; + public JpackageOptions modulePath(String... paths) { + return modulePathStrings(List.of(paths)); } /** @@ -807,11 +829,11 @@ public JpackageOptions modulePath(String... path) { *

* Each path is absolute or relative to the current directory. * - * @param path one or more path + * @param paths one or more path * @return this map of options */ - public JpackageOptions modulePath(File... path) { - put("--module-path", String.join(":", Arrays.stream(path).map(File::getAbsolutePath).toList())); + public JpackageOptions modulePathStrings(List paths) { + put("--module-path", String.join(":", paths)); return this; } @@ -822,13 +844,53 @@ public JpackageOptions modulePath(File... path) { *

* Each path is absolute or relative to the current directory. * - * @param path one or more path + * @param paths one or more path * @return this map of options */ - public JpackageOptions modulePath(Path... path) { - put("--module-path", String.join(":", - Arrays.stream(path).map(Path::toFile).map(File::getAbsolutePath).toList())); - return this; + public JpackageOptions modulePath(File... paths) { + return modulePath(List.of(paths)); + } + + /** + * List of module paths. + *

+ * Each path is either a directory of modules or the path to a modular jar. + *

+ * Each path is absolute or relative to the current directory. + * + * @param paths one or more path + * @return this map of options + */ + public JpackageOptions modulePath(List paths) { + return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList()); + } + + /** + * List of module paths. + *

+ * Each path is either a directory of modules or the path to a modular jar. + *

+ * Each path is absolute or relative to the current directory. + * + * @param paths one or more path + * @return this map of options + */ + public JpackageOptions modulePath(Path... paths) { + return modulePathPaths(List.of(paths)); + } + + /** + * List of module paths. + *

+ * Each path is either a directory of modules or the path to a modular jar. + *

+ * Each path is absolute or relative to the current directory. + * + * @param paths one or more path + * @return this map of options + */ + public JpackageOptions modulePathPaths(List paths) { + return modulePath(paths.stream().map(Path::toFile).toList()); } /** @@ -877,8 +939,7 @@ public JpackageOptions resourceDir(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions resourceDir(File path) { - put("--resource-dir", path.getAbsolutePath()); - return this; + return resourceDir(path.getAbsolutePath()); } /** @@ -891,8 +952,7 @@ public JpackageOptions resourceDir(File path) { * @return this map of options */ public JpackageOptions resourceDir(Path path) { - put("--resource-dir", path.toFile().getAbsolutePath()); - return this; + return resourceDir(path.toFile()); } /** @@ -928,8 +988,7 @@ public JpackageOptions runtimeImage(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions runtimeImage(File path) { - put("--runtime-image", path.getAbsolutePath()); - return this; + return runtimeImage(path.getAbsolutePath()); } /** @@ -946,8 +1005,7 @@ public JpackageOptions runtimeImage(File path) { * @return this map of options */ public JpackageOptions runtimeImage(Path path) { - put("--runtime-image", path.toFile().getAbsolutePath()); - return this; + return runtimeImage(path.toFile()); } /** @@ -992,8 +1050,7 @@ public JpackageOptions temp(String path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions temp(File path) { - put("--temp", path.getAbsolutePath()); - return this; + return temp(path.getAbsolutePath()); } /** @@ -1007,8 +1064,7 @@ public JpackageOptions temp(File path) { * @return this map of options */ public JpackageOptions temp(Path path) { - put("--temp", path.toFile().getAbsolutePath()); - return this; + return temp(path.toFile()); } /**