2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 00:07:12 -07:00

Cleanups to JlinkOptions, JmodOptions and JpackageOptions

This commit is contained in:
Geert Bevin 2024-08-25 22:55:40 -04:00
parent 22add235e3
commit b8a63dd79c
3 changed files with 140 additions and 104 deletions

View file

@ -173,8 +173,7 @@ public class JlinkOptions extends HashMap<String, String> {
* @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 class JlinkOptions extends HashMap<String, String> {
* @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 class JlinkOptions extends HashMap<String, String> {
* @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 class JlinkOptions extends HashMap<String, String> {
* @return this map of options
*/
public JlinkOptions output(Path path) {
put("--output", path.toFile().getAbsolutePath());
return this;
return output(path.toFile());
}
/**

View file

@ -49,8 +49,7 @@ public class JmodOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions cmds(File path) {
put("--cmds", path.getAbsolutePath());
return this;
return cmds(path.getAbsolutePath());
}
/**
@ -60,8 +59,7 @@ public class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions headerFiles(File path) {
put("--header-files", path.getAbsolutePath());
return this;
return headerFiles(path.getAbsolutePath());
}
/**
@ -252,8 +245,7 @@ public class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions legalNotices(File path) {
put("--legal-notices", path.getAbsolutePath());
return this;
return legalNotices(path.getAbsolutePath());
}
/**
@ -286,8 +277,7 @@ public class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions libs(File path) {
put("--libs", path.getAbsolutePath());
return this;
return libs(path.getAbsolutePath());
}
/**
@ -320,8 +309,7 @@ public class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions manPages(File path) {
put("--man-pages", path.getAbsolutePath());
return this;
return manPages(path.getAbsolutePath());
}
/**
@ -365,8 +352,7 @@ public class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
* @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 class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions modulePath(Path path) {
put("--module-path", path.toFile().getAbsolutePath());
return this;
return modulePath(path.toFile());
}
/**

View file

@ -8,6 +8,7 @@ import java.io.File;
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 class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions appImage(Path path) {
put("--app-image", path.toFile().getAbsolutePath());
return this;
return appImage(path.toFile());
}
/**
@ -157,8 +156,7 @@ public class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions dest(File path) {
put("--dest", path.getAbsolutePath());
return this;
return dest(path.getAbsolutePath());
}
/**
@ -170,8 +168,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
* 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.
* <p>
* 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<String> paths) {
put("--file-associations", String.join(",", paths));
return this;
}
@ -194,13 +204,12 @@ public class JpackageOptions extends HashMap<String, String> {
* 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 class JpackageOptions extends HashMap<String, String> {
* 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<File> paths) {
return fileAssociationsStrings(paths.stream().map(File::getAbsolutePath).toList());
}
/**
* Path to a Properties file that contains list of key, value pairs.
* <p>
* 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.
* <p>
* 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<Path> paths) {
return fileAssociations(paths.stream().map(Path::toFile).toList());
}
/**
@ -237,8 +270,7 @@ public class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions icon(File path) {
put("--icon", path.getAbsolutePath());
return this;
return icon(path.getAbsolutePath());
}
/**
@ -248,8 +280,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions installDir(File path) {
put("--install-dir", path.getAbsolutePath());
return this;
return installDir(path.getAbsolutePath());
}
/**
@ -321,8 +349,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions licenseFile(File path) {
put("--license-file", path.getAbsolutePath());
return this;
return licenseFile(path.getAbsolutePath());
}
/**
@ -399,8 +425,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions macEntitlements(File path) {
put("--mac-entitlements", path.getAbsolutePath());
return this;
return macEntitlements(path.getAbsolutePath());
}
/**
@ -609,8 +633,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions macEntitlements(Path path) {
put("--mac-entitlements", path.toFile().getAbsolutePath());
return this;
return macEntitlements(path.toFile());
}
/**
@ -792,11 +815,25 @@ public class JpackageOptions extends HashMap<String, String> {
* <p>
* 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));
public JpackageOptions modulePath(String... paths) {
return modulePathStrings(List.of(paths));
}
/**
* List of module paths.
* <p>
* Each path is either a directory of modules or the path to a modular jar.
* <p>
* Each path is absolute or relative to the current directory.
*
* @param paths one or more path
* @return this map of options
*/
public JpackageOptions modulePathStrings(List<String> paths) {
put("--module-path", String.join(":", paths));
return this;
}
@ -807,12 +844,11 @@ public class JpackageOptions extends HashMap<String, String> {
* <p>
* 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()));
return this;
public JpackageOptions modulePath(File... paths) {
return modulePath(List.of(paths));
}
/**
@ -822,13 +858,39 @@ public class JpackageOptions extends HashMap<String, String> {
* <p>
* 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(List<File> paths) {
return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
}
/**
* List of module paths.
* <p>
* Each path is either a directory of modules or the path to a modular jar.
* <p>
* 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.
* <p>
* Each path is either a directory of modules or the path to a modular jar.
* <p>
* 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<Path> paths) {
return modulePath(paths.stream().map(Path::toFile).toList());
}
/**
@ -877,8 +939,7 @@ public class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions resourceDir(File path) {
put("--resource-dir", path.getAbsolutePath());
return this;
return resourceDir(path.getAbsolutePath());
}
/**
@ -891,8 +952,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions runtimeImage(File path) {
put("--runtime-image", path.getAbsolutePath());
return this;
return runtimeImage(path.getAbsolutePath());
}
/**
@ -946,8 +1005,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @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 class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions temp(File path) {
put("--temp", path.getAbsolutePath());
return this;
return temp(path.getAbsolutePath());
}
/**
@ -1007,8 +1064,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions temp(Path path) {
put("--temp", path.toFile().getAbsolutePath());
return this;
return temp(path.toFile());
}
/**