mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-25 16:27:11 -07:00
Merge pull request #47 from ethauvin/main
Added JlinkOptions, JmodOptions and JpackageOptions File argument alt…
This commit is contained in:
commit
22add235e3
10 changed files with 1211 additions and 65 deletions
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -23,7 +26,6 @@ public class JlinkOperation extends AbstractToolProviderOperation<JlinkOperation
|
|||
super("jlink");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
|
@ -35,6 +37,28 @@ public class JlinkOperation extends AbstractToolProviderOperation<JlinkOperation
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
* @param file one or more file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JlinkOperation cmdFiles(File... file) {
|
||||
cmdFiles_.addAll(Arrays.stream(file).map(File::getAbsolutePath).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
* @param file one or more file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JlinkOperation cmdFiles(Path... file) {
|
||||
cmdFiles_.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of files containing options or mode.
|
||||
*
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -161,6 +163,34 @@ public class JlinkOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module path.
|
||||
* <p>
|
||||
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
|
||||
* java.base module, the JDKs jmods directory will be added, if it exists.
|
||||
*
|
||||
* @param path the module path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JlinkOptions modulePath(File path) {
|
||||
put("--module-path", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module path.
|
||||
* <p>
|
||||
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
|
||||
* java.base module, the JDKs jmods directory will be added, if it exists.
|
||||
*
|
||||
* @param path the module path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JlinkOptions modulePath(Path path) {
|
||||
put("--module-path", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude include header files.
|
||||
*
|
||||
|
@ -202,6 +232,28 @@ public class JlinkOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of output path.
|
||||
*
|
||||
* @param path the output path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JlinkOptions output(File path) {
|
||||
put("--output", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of output path.
|
||||
*
|
||||
* @param path the output path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JlinkOptions output(Path path) {
|
||||
put("--output", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
|
||||
* key, the old value is replaced.
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -44,6 +47,28 @@ public class JmodOperation extends AbstractToolProviderOperation<JmodOperation>
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
* @param file one or more file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JmodOperation cmdFiles(File... file) {
|
||||
cmdFiles.addAll(Arrays.stream(file).map(File::getAbsolutePath).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
* @param file one or more file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JmodOperation cmdFiles(Path... file) {
|
||||
cmdFiles.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
if (operationMode_ != null) {
|
||||
|
@ -82,6 +107,32 @@ public class JmodOperation extends AbstractToolProviderOperation<JmodOperation>
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies name of the JMOD file to create or from which to retrieve information.
|
||||
* <p>
|
||||
* The JMOD file is <b>required</b>.
|
||||
*
|
||||
* @param file the JMOD file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JmodOperation jmodFile(File file) {
|
||||
jmodFile_ = file.getAbsolutePath();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies name of the JMOD file to create or from which to retrieve information.
|
||||
* <p>
|
||||
* The JMOD file is <b>required</b>.
|
||||
*
|
||||
* @param file the JMOD file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JmodOperation jmodFile(Path file) {
|
||||
jmodFile_ = file.toFile().getAbsolutePath();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of options for the jmod tool.
|
||||
* <p>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
@ -39,6 +41,29 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of native commands.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JmodOptions cmds(File path) {
|
||||
put("--cmds", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of native commands.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions cmds(Path path) {
|
||||
put("--cmds", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compression to use when creating the JMOD archive.
|
||||
* <p>
|
||||
|
@ -52,6 +77,7 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
* @param compression the {@link ZipCompression compression} level
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JmodOptions compress(ZipCompression compression) {
|
||||
put("--compress", compression.level);
|
||||
return this;
|
||||
|
@ -68,6 +94,28 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of user-editable config files
|
||||
*
|
||||
* @param path the path to the config files
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions config(File path) {
|
||||
put("--config", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of user-editable config files
|
||||
*
|
||||
* @param path the path to the config files
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions config(Path path) {
|
||||
put("--config", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date and time for the timestamps of entries.
|
||||
*
|
||||
|
@ -90,6 +138,28 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Target directory for extract
|
||||
*
|
||||
* @param path the directory path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions dir(File path) {
|
||||
put("--dir", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Target directory for extract
|
||||
*
|
||||
* @param path the directory path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions dir(Path path) {
|
||||
put("--dir", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude from the default root set of modules.
|
||||
*
|
||||
|
@ -163,6 +233,29 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of header files.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JmodOptions headerFiles(File path) {
|
||||
put("--header-files", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of header files.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions headerFiles(Path path) {
|
||||
put("--header-files", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of legal notices.
|
||||
*
|
||||
|
@ -174,6 +267,29 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of legal notices.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JmodOptions legalNotices(File path) {
|
||||
put("--legal-notices", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of legal notices.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions legalNotices(Path path) {
|
||||
put("--legal-notices", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of native libraries.
|
||||
*
|
||||
|
@ -185,6 +301,29 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of native libraries.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JmodOptions libs(File path) {
|
||||
put("--libs", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of native libraries.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions libs(Path path) {
|
||||
put("--libs", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main class.
|
||||
*
|
||||
|
@ -207,6 +346,29 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of man pages.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JmodOptions manPages(File path) {
|
||||
put("--man-pages", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of man pages.
|
||||
*
|
||||
* @param path the location
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions manPages(Path path) {
|
||||
put("--man-pages", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module path.
|
||||
*
|
||||
|
@ -218,6 +380,28 @@ public class JmodOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module path.
|
||||
*
|
||||
* @param path the module path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions modulePath(File path) {
|
||||
put("--module-path", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module path.
|
||||
*
|
||||
* @param path the module path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions modulePath(Path path) {
|
||||
put("--module-path", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module version.
|
||||
*
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -17,25 +20,48 @@ import java.util.Map;
|
|||
public class JpackageOperation extends AbstractToolProviderOperation<JpackageOperation> {
|
||||
private final List<String> cmdFiles_ = new ArrayList<>();
|
||||
private final JpackageOptions jpackageOptions_ = new JpackageOptions();
|
||||
private final List<Launcher> launchers_ = new ArrayList<>();
|
||||
|
||||
public JpackageOperation() {
|
||||
super("jpackage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
toolArgs(cmdFiles_.stream().map(opt -> '@' + opt).toList());
|
||||
toolArgs(jpackageOptions_);
|
||||
super.execute();
|
||||
/**
|
||||
* List of application launchers.
|
||||
* <p>
|
||||
* The main application launcher will be built from the command line options.
|
||||
* <p>
|
||||
* Additional alternative launchers can be built using this option, and this option can be used to build multiple
|
||||
* additional launchers.
|
||||
*
|
||||
* @param launcher one or more {@link JpackageOperation.Launcher}
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JpackageOperation addLauncher(Launcher... launcher) {
|
||||
launchers_.addAll(Arrays.asList(launcher));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of files containing options or mode.
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
* @return the list of files
|
||||
* @param file one or more file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public List<String> fileOptions() {
|
||||
return cmdFiles_;
|
||||
public JpackageOperation cmdFiles(File... file) {
|
||||
cmdFiles_.addAll(Arrays.stream(file).map(File::getAbsolutePath).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read options and/or mode from file(s).
|
||||
*
|
||||
* @param file one or more file
|
||||
* @return this operation instance
|
||||
*/
|
||||
public JpackageOperation cmdFiles(Path... file) {
|
||||
cmdFiles_.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,6 +75,25 @@ public class JpackageOperation extends AbstractToolProviderOperation<JpackageOpe
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of files containing options or mode.
|
||||
*
|
||||
* @return the list of files
|
||||
*/
|
||||
public List<String> cmdFiles() {
|
||||
return cmdFiles_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
toolArgs(cmdFiles_.stream().map(opt -> '@' + opt).toList());
|
||||
for (var l : launchers_) {
|
||||
toolArgs("--add-launcher", l.name + '=' + l.path);
|
||||
}
|
||||
toolArgs(jpackageOptions_);
|
||||
super.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of options for the jpackage tool.
|
||||
* <p>
|
||||
|
@ -72,4 +117,37 @@ public class JpackageOperation extends AbstractToolProviderOperation<JpackageOpe
|
|||
jpackageOptions_.putAll(options);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of application launchers.
|
||||
*
|
||||
* @return the list of launchers
|
||||
*/
|
||||
public List<Launcher> launchers() {
|
||||
return launchers_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of launcher, and a path to a Properties file that contains a list of key, value pairs.
|
||||
* <p>
|
||||
* The keys {@code module}, {@code main-jar}, {@code main-class}, {@code description},
|
||||
* {@code arguments}, {@code java-options}, {@code app-version}, {@code icon},
|
||||
* {@code launcher-as-service}, {@code win-console}, {@code win-shortcut}, {@code win-menu},
|
||||
* {@code linux-app-category}, and {@code linux-shortcut} can be used.
|
||||
* <p>
|
||||
* These options are added to, or used to overwrite, the original command line options to build an additional
|
||||
* alternative launcher.
|
||||
*
|
||||
* @param name the name
|
||||
* @param path absolute path or relative to the current directory
|
||||
*/
|
||||
public record Launcher(String name, String path) {
|
||||
public Launcher(String name, File path) {
|
||||
this(name, path.getAbsolutePath());
|
||||
}
|
||||
|
||||
public Launcher(String name, Path path) {
|
||||
this(name, path.toFile().getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
|
@ -24,24 +27,6 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of application launchers.
|
||||
* <p>
|
||||
* The main application launcher will be built from the command line options.
|
||||
* <p>
|
||||
* Additional alternative launchers can be built using this option, and this option can be used to build multiple
|
||||
* additional launchers.
|
||||
*
|
||||
* @param launcher one or more {@link Launcher}
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions addLauncher(Launcher... launcher) {
|
||||
for (var l : launcher) {
|
||||
put("--add-launcher", l.name + '=' + l.path);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of modules to add.
|
||||
* <p>
|
||||
|
@ -82,6 +67,29 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of the predefined application image that is used to build an installable package.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions appImage(File path) {
|
||||
put("--app-image", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Location of the predefined application image that is used to build an installable package.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions appImage(Path path) {
|
||||
put("--app-image", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Version of the application and/or package.
|
||||
*
|
||||
|
@ -139,6 +147,33 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path where generated output file is placed.
|
||||
* <p>
|
||||
* Defaults to the current working directory.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions dest(File path) {
|
||||
put("--dest", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path where generated output file is placed.
|
||||
* <p>
|
||||
* Defaults to the current working directory.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions dest(Path path) {
|
||||
put("--dest", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to a Properties file that contains list of key, value pairs.
|
||||
* <p>
|
||||
|
@ -153,6 +188,36 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 path 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 path 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the icon of the application package.
|
||||
*
|
||||
|
@ -164,6 +229,29 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the icon of the application package.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions icon(File path) {
|
||||
put("--icon", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the icon of the application package.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions icon(Path path) {
|
||||
put("--icon", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the input directory that contains the files to be packaged.
|
||||
* <p>
|
||||
|
@ -177,6 +265,32 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the input directory that contains the files to be packaged.
|
||||
* <p>
|
||||
* All files in the input directory will be packaged into the application image.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions input(File path) {
|
||||
put("--input", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the input directory that contains the files to be packaged.
|
||||
* <p>
|
||||
* All files in the input directory will be packaged into the application image.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions input(Path path) {
|
||||
put("--input", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute path of the installation directory of the application.
|
||||
*
|
||||
|
@ -188,6 +302,29 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute path of the installation directory of the application.
|
||||
*
|
||||
* @param path the absolute directory path
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions installDir(File path) {
|
||||
put("--install-dir", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute path of the installation directory of the application.
|
||||
*
|
||||
* @param path the absolute directory path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions installDir(Path path) {
|
||||
put("--install-dir", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to pass to the Java runtime.
|
||||
*
|
||||
|
@ -243,6 +380,29 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the license file.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions licenseFile(File path) {
|
||||
put("--license-file", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the license file.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions licenseFile(Path path) {
|
||||
put("--license-file", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Group value of the RPM {@code <name>.spec} file or Section value of DEB control file.
|
||||
*
|
||||
|
@ -395,6 +555,30 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Include all the referenced content in the dmg.
|
||||
*
|
||||
* @param additionalContent one or more path
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions macDmgContent(File... additionalContent) {
|
||||
put("--mac-dmg-content", String.join(",", Arrays.stream(additionalContent).map(File::getAbsolutePath).toList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Include all the referenced content in the dmg.
|
||||
*
|
||||
* @param additionalContent one or more path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions macDmgContent(Path... additionalContent) {
|
||||
put("--mac-dmg-content", String.join(",",
|
||||
Arrays.stream(additionalContent).map(Path::toFile).map(File::getAbsolutePath).toList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to file containing entitlements to use when signing executables and libraries in the bundle.
|
||||
*
|
||||
|
@ -406,6 +590,29 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to file containing entitlements to use when signing executables and libraries in the bundle.
|
||||
*
|
||||
* @param path the fie path
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions macEntitlements(File path) {
|
||||
put("--mac-entitlements", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to file containing entitlements to use when signing executables and libraries in the bundle.
|
||||
*
|
||||
* @param path the fie path
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions macEntitlements(Path path) {
|
||||
put("--mac-entitlements", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identity used to sign "pkg" installer.
|
||||
* <p>
|
||||
|
@ -574,7 +781,7 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
*/
|
||||
@SuppressWarnings("JavadocDeclaration")
|
||||
public JpackageOptions module(String name, String mainClass) {
|
||||
put("--module-name", name + "/" + mainClass);
|
||||
put("--module", name + "/" + mainClass);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -593,6 +800,37 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 path 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 path 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the application and/or package.
|
||||
*
|
||||
|
@ -628,6 +866,35 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to override jpackage resources.
|
||||
* <p>
|
||||
* Icons, template files, and other resources of jpackage can be over-ridden by adding replacement resources to
|
||||
* this directory.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions resourceDir(File path) {
|
||||
put("--resource-dir", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to override jpackage resources.
|
||||
* <p>
|
||||
* Icons, template files, and other resources of jpackage can be over-ridden by adding replacement resources to
|
||||
* this directory.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions resourceDir(Path path) {
|
||||
put("--resource-dir", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the predefined runtime image that will be copied into the application image.
|
||||
* <p>
|
||||
|
@ -646,6 +913,43 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the predefined runtime image that will be copied into the application image.
|
||||
* <p>
|
||||
* If not specified, jpackage will run jlink to create the runtime image using options:
|
||||
* {@link JlinkOptions#stripNativeCommands(boolean) stripNativeCommands}
|
||||
* {@link JlinkOptions#stripDebug(boolean) stripDebug} {@link JlinkOptions#noManPages(boolean) noManPages}
|
||||
* {@link JlinkOptions#noHeaderFiles(boolean) noHeaderFiles}
|
||||
* <p>
|
||||
* Option is required when creating a runtime package.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions runtimeImage(File path) {
|
||||
put("--runtime-image", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of the predefined runtime image that will be copied into the application image.
|
||||
* <p>
|
||||
* If not specified, jpackage will run jlink to create the runtime image using options:
|
||||
* {@link JlinkOptions#stripNativeCommands(boolean) stripNativeCommands}
|
||||
* {@link JlinkOptions#stripDebug(boolean) stripDebug} {@link JlinkOptions#noManPages(boolean) noManPages}
|
||||
* {@link JlinkOptions#noHeaderFiles(boolean) noHeaderFiles}
|
||||
* <p>
|
||||
* Option is required when creating a runtime package.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions runtimeImage(Path path) {
|
||||
put("--runtime-image", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip debug information.
|
||||
*
|
||||
|
@ -676,6 +980,37 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of a new or empty directory used to create temporary files.
|
||||
* <p>
|
||||
* If specified, the temp dir will not be removed upon the task completion and must be removed manually.
|
||||
* <p>
|
||||
* If not specified, a temporary directory will be created and removed upon the task completion.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions temp(File path) {
|
||||
put("--temp", path.getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of a new or empty directory used to create temporary files.
|
||||
* <p>
|
||||
* If specified, the temp dir will not be removed upon the task completion and must be removed manually.
|
||||
* <p>
|
||||
* If not specified, a temporary directory will be created and removed upon the task completion.
|
||||
*
|
||||
* @param path absolute path or relative to the current directory
|
||||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions temp(Path path) {
|
||||
put("--temp", path.toFile().getAbsolutePath());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of package to create.
|
||||
* <p>
|
||||
|
@ -868,21 +1203,4 @@ public class JpackageOptions extends HashMap<String, String> {
|
|||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of launcher, and a path to a Properties file that contains a list of key, value pairs.
|
||||
* <p>
|
||||
* The keys {@code module}, {@code main-jar}, {@code main-class}, {@code description},
|
||||
* {@code arguments}, {@code java-options}, {@code app-version}, {@code icon},
|
||||
* {@code launcher-as-service}, {@code win-console}, {@code win-shortcut}, {@code win-menu},
|
||||
* {@code linux-app-category}, and {@code linux-shortcut} can be used.
|
||||
* <p>
|
||||
* These options are added to, or used to overwrite, the original command line options to build an additional
|
||||
* alternative launcher.
|
||||
*
|
||||
* @param name the name
|
||||
* @param path absolute path or relative to the current directory
|
||||
*/
|
||||
public record Launcher(String name, String path) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue