--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java Thu Apr 18 19:36:55 2019 -0400
@@ -49,7 +49,6 @@
*
* The add-launcher properties file may have any of:
*
- * name (required)
* appVersion
* module
* add-modules
@@ -63,11 +62,13 @@
*/
class AddLauncherArguments {
+ private final String name;
private final String filename;
private Map<String, String> allArgs;
private Map<String, ? super Object> bundleParams;
- AddLauncherArguments(String filename) {
+ AddLauncherArguments(String name, String filename) {
+ this.name = name;
this.filename = filename;
}
@@ -77,6 +78,7 @@
}
allArgs = Arguments.getPropertiesFromFile(filename);
+ allArgs.put(CLIOptions.NAME.getId(), name);
bundleParams = new HashMap<>();
String mainJar = getOptionValue(CLIOptions.MAIN_JAR);
@@ -84,34 +86,34 @@
String module = getOptionValue(CLIOptions.MODULE);
if (module != null && mainClass != null) {
- putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(),
+ putUnlessNull(bundleParams, CLIOptions.MODULE.getId(),
module + "/" + mainClass);
} else if (module != null) {
- putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(),
+ putUnlessNull(bundleParams, CLIOptions.MODULE.getId(),
module);
} else {
- putUnlessNull(bundleParams, Arguments.CLIOptions.MAIN_JAR.getId(),
+ putUnlessNull(bundleParams, CLIOptions.MAIN_JAR.getId(),
mainJar);
- putUnlessNull(bundleParams, Arguments.CLIOptions.APPCLASS.getId(),
+ putUnlessNull(bundleParams, CLIOptions.APPCLASS.getId(),
mainClass);
}
- putUnlessNull(bundleParams, Arguments.CLIOptions.NAME.getId(),
+ putUnlessNull(bundleParams, CLIOptions.NAME.getId(),
getOptionValue(CLIOptions.NAME));
- putUnlessNull(bundleParams, Arguments.CLIOptions.VERSION.getId(),
+ putUnlessNull(bundleParams, CLIOptions.VERSION.getId(),
getOptionValue(CLIOptions.VERSION));
putUnlessNull(bundleParams,
- Arguments.CLIOptions.ADD_MODULES.getId(),
+ CLIOptions.ADD_MODULES.getId(),
getOptionValue(CLIOptions.ADD_MODULES));
putUnlessNull(bundleParams,
- Arguments.CLIOptions.WIN_CONSOLE_HINT.getId(),
+ CLIOptions.WIN_CONSOLE_HINT.getId(),
getOptionValue(CLIOptions.WIN_CONSOLE_HINT));
String value = getOptionValue(CLIOptions.ICON);
- putUnlessNull(bundleParams, Arguments.CLIOptions.ICON.getId(),
+ putUnlessNull(bundleParams, CLIOptions.ICON.getId(),
(value == null) ? null : new File(value));
String argumentStr = getOptionValue(CLIOptions.ARGUMENTS);
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Thu Apr 18 19:36:55 2019 -0400
@@ -263,8 +263,16 @@
ADD_LAUNCHER ("add-launcher",
OptionCategories.PROPERTY, () -> {
+ String spec = popArg();
+ String name = null;
+ String filename = spec;
+ if (spec.contains("=")) {
+ String[] values = spec.split("=", 2);
+ name = values[0];
+ filename = values[1];
+ }
context().addLaunchers.add(
- new AddLauncherArguments(popArg()));
+ new AddLauncherArguments(name, filename));
}),
TEMP_ROOT ("temp-root", OptionCategories.PROPERTY, () -> {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Thu Apr 18 19:36:55 2019 -0400
@@ -59,6 +59,7 @@
Generic Options:\n\
\ @<filename> \n\
\ Read options and/or mode from a file \n\
+\ This option can be used multiple times.\n\
\ --app-version <version>\n\
\ Version of the application and/or installer\n\
\ --copyright <copyright string>\n\
@@ -95,11 +96,13 @@
\ if not specified, either just the main module (if --module is\n\
\ specified), or the default set of modules (if --main-jar is \n\
\ specified) are used.\n\
+\ This option can be used multiple times.\n\
\ --module-path -p <module path>...\n\
\ A {0} separated list of paths\n\
\ Each path is either a directory of modules or the path to a\n\
\ modular jar.\n\
\ (each path is absolute or relative to the current directory)\n\
+\ This option can be used multiple times.\n\
\ --runtime-image <file path>\n\
\ Path of the predefined runtime image that will be copied into\n\
\ the application image\n\
@@ -121,22 +124,26 @@
\ application image.\n\
\n\
\Options for creating the application launcher(s):\n\
-\ --add-launcher <file path>\n\
-\ Path to a Properties file that contains list of key, value pairs\n\
+\ --add-launcher <launcher name>=<file path>\n\
+\ Name of launcher, and a path to a Properties file that contains\n\
+\ a list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
-\ The keys "name" (required), "module", "add-modules",\n\
-\ "main-jar", "main-class", "arguments", "java-options",\n\
-\ "app-version", "icon", and "win-console" can be used.\n\
+\ The keys "module", "add-modules", "main-jar", "main-class",\n\
+\ "arguments", "java-options", "app-version", "icon", and\n\
+\ "win-console" can be used.\n\
\ These options are added to, or used to overwrite, the original\n\
\ command line options to build an additional alternative launcher.\n\
\ The main application launcher will be built from the command line\n\
-\ options. Additional alternative launchers may be built using\n\
-\ this option.\n\
+\ options. Additional alternative launchers can be built using\n\
+\ this option, and this option can be used multiple times to\n\
+\ build multiple additional launchers. \n\
\ --arguments <main class arguments>\n\
\ Command line arguments to pass to the main class if no command\n\
\ line arguments are given to the launcher\n\
+\ This option can be used multiple times.\n\
\ --java-options <java options>\n\
\ Options to pass to the Java runtime\n\
+\ This option can be used multiple times.\n\
\ --main-class <class name>\n\
\ Qualified name of the application main class to execute\n\
\ This option can only be used if --main-jar is specified.\n\
@@ -163,6 +170,7 @@
\ (absolute path or relative to the current directory)\n\
\ The keys "extension", "mime-type", "icon", and "description"\n\
\ can be used to describe the association.\n\
+\ This option can be used multiple times.\n\
\ --identifier <id string>\n\
\ An identifier that uniquely identifies the application\n\
\ Defaults to the main class name.\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Thu Apr 18 19:36:55 2019 -0400
@@ -59,6 +59,7 @@
Generic Options:\n\
\ @<filename> \n\
\ Read options and/or mode from a file \n\
+\ This option can be used multiple times.\n\
\ --app-version <version>\n\
\ Version of the application and/or installer\n\
\ --copyright <copyright string>\n\
@@ -95,11 +96,13 @@
\ if not specified, either just the main module (if --module is\n\
\ specified), or the default set of modules (if --main-jar is \n\
\ specified) are used.\n\
+\ This option can be used multiple times.\n\
\ --module-path -p <module path>...\n\
\ A {0} separated list of paths\n\
\ Each path is either a directory of modules or the path to a\n\
\ modular jar.\n\
\ (each path is absolute or relative to the current directory)\n\
+\ This option can be used multiple times.\n\
\ --runtime-image <file path>\n\
\ Path of the predefined runtime image that will be copied into\n\
\ the application image\n\
@@ -121,22 +124,26 @@
\ application image.\n\
\n\
\Options for creating the application launcher(s):\n\
-\ --add-launcher <file path>\n\
-\ Path to a Properties file that contains list of key, value pairs\n\
+\ --add-launcher <launcher name>=<file path>\n\
+\ Name of launcher, and a path to a Properties file that contains\n\
+\ a list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
-\ The keys "name" (required), "module", "add-modules",\n\
-\ "main-jar", "main-class", "arguments", "java-options",\n\
-\ "app-version", "icon", and "win-console" can be used.\n\
+\ The keys "module", "add-modules", "main-jar", "main-class",\n\
+\ "arguments", "java-options", "app-version", "icon", and\n\
+\ "win-console" can be used.\n\
\ These options are added to, or used to overwrite, the original\n\
\ command line options to build an additional alternative launcher.\n\
\ The main application launcher will be built from the command line\n\
-\ options. Additional alternative launchers may be built using\n\
-\ this option.\n\
+\ options. Additional alternative launchers can be built using\n\
+\ this option, and this option can be used multiple times to\n\
+\ build multiple additional launchers. \n\
\ --arguments <main class arguments>\n\
\ Command line arguments to pass to the main class if no command\n\
\ line arguments are given to the launcher\n\
+\ This option can be used multiple times.\n\
\ --java-options <java options>\n\
\ Options to pass to the Java runtime\n\
+\ This option can be used multiple times.\n\
\ --main-class <class name>\n\
\ Qualified name of the application main class to execute\n\
\ This option can only be used if --main-jar is specified.\n\
@@ -163,6 +170,7 @@
\ (absolute path or relative to the current directory)\n\
\ The keys "extension", "mime-type", "icon", and "description"\n\
\ can be used to describe the association.\n\
+\ This option can be used multiple times.\n\
\ --identifier <id string>\n\
\ An identifier that uniquely identifies the application\n\
\ Defaults to the main class name.\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Thu Apr 18 19:36:55 2019 -0400
@@ -59,6 +59,7 @@
Generic Options:\n\
\ @<filename> \n\
\ Read options and/or mode from a file \n\
+\ This option can be used multiple times.\n\
\ --app-version <version>\n\
\ Version of the application and/or installer\n\
\ --copyright <copyright string>\n\
@@ -95,11 +96,13 @@
\ if not specified, either just the main module (if --module is\n\
\ specified), or the default set of modules (if --main-jar is \n\
\ specified) are used.\n\
+\ This option can be used multiple times.\n\
\ --module-path -p <module path>...\n\
\ A {0} separated list of paths\n\
\ Each path is either a directory of modules or the path to a\n\
\ modular jar.\n\
\ (each path is absolute or relative to the current directory)\n\
+\ This option can be used multiple times.\n\
\ --runtime-image <file path>\n\
\ Path of the predefined runtime image that will be copied into\n\
\ the application image\n\
@@ -121,22 +124,26 @@
\ application image.\n\
\n\
\Options for creating the application launcher(s):\n\
-\ --add-launcher <file path>\n\
-\ Path to a Properties file that contains list of key, value pairs\n\
+\ --add-launcher <launcher name>=<file path>\n\
+\ Name of launcher, and a path to a Properties file that contains\n\
+\ a list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
-\ The keys "name" (required), "module", "add-modules",\n\
-\ "main-jar", "main-class", "arguments", "java-options",\n\
-\ "app-version", "icon", and "win-console" can be used.\n\
+\ The keys "module", "add-modules", "main-jar", "main-class",\n\
+\ "arguments", "java-options", "app-version", "icon", and\n\
+\ "win-console" can be used.\n\
\ These options are added to, or used to overwrite, the original\n\
\ command line options to build an additional alternative launcher.\n\
\ The main application launcher will be built from the command line\n\
-\ options. Additional alternative launchers may be built using\n\
-\ this option.\n\
+\ options. Additional alternative launchers can be built using\n\
+\ this option, and this option can be used multiple times to\n\
+\ build multiple additional launchers. \n\
\ --arguments <main class arguments>\n\
\ Command line arguments to pass to the main class if no command\n\
\ line arguments are given to the launcher\n\
+\ This option can be used multiple times.\n\
\ --java-options <java options>\n\
\ Options to pass to the Java runtime\n\
+\ This option can be used multiple times.\n\
\ --main-class <class name>\n\
\ Qualified name of the application main class to execute\n\
\ This option can only be used if --main-jar is specified.\n\
@@ -163,6 +170,7 @@
\ (absolute path or relative to the current directory)\n\
\ The keys "extension", "mime-type", "icon", and "description"\n\
\ can be used to describe the association.\n\
+\ This option can be used multiple times.\n\
\ --identifier <id string>\n\
\ An identifier that uniquely identifies the application\n\
\ Defaults to the main class name.\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Thu Apr 18 19:36:55 2019 -0400
@@ -81,8 +81,8 @@
ERR_MissingAppResources=Error: No application jars found.
ERR_AppImageNotExist=Error: App image directory "{0}" does not exist.
ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory.
-ERR_NoAddLauncherName=Error: Add Launchers require a name parameter.
-ERR_NoUniqueName=Error: Add Launchers require a unique name parameter.
+ERR_NoAddLauncherName=Error: --add-launcher option requires a name and a file path (--add-launcher <name>=<file path>).
+ERR_NoUniqueName=Error: --add-launcher <name>=<file path> requires a unique name.
ERR_NoJreInstallerName=Error: Jre Installers require a name parameter.
ERR_InvalidAppName=Error: Invalid Application name: {0}.
ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Thu Apr 18 19:36:55 2019 -0400
@@ -81,8 +81,8 @@
ERR_MissingAppResources=Error: No application jars found.
ERR_AppImageNotExist=Error: App image directory "{0}" does not exist.
ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory.
-ERR_NoAddLauncherName=Error: Add Launchers require a name parameter.
-ERR_NoUniqueName=Error: Add Launchers require a unique name parameter.
+ERR_NoAddLauncherName=Error: --add-launcher option requires a name and a file path (--add-launcher <name>=<file path>).
+ERR_NoUniqueName=Error: --add-launcher <name>=<file path> requires a unique name.
ERR_NoJreInstallerName=Error: Jre Installers require a name parameter.
ERR_InvalidAppName=Error: Invalid Application name: {0}.
ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Mon Apr 15 12:03:26 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Thu Apr 18 19:36:55 2019 -0400
@@ -81,8 +81,8 @@
ERR_MissingAppResources=Error: No application jars found.
ERR_AppImageNotExist=Error: App image directory "{0}" does not exist.
ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory.
-ERR_NoAddLauncherName=Error: Add Launchers require a name parameter.
-ERR_NoUniqueName=Error: Add Launchers require a unique name parameter.
+ERR_NoAddLauncherName=Error: --add-launcher option requires a name and a file path (--add-launcher <name>=<file path>).
+ERR_NoUniqueName=Error: --add-launcher <name>=<file path> requires a unique name.
ERR_NoJreInstallerName=Error: Jre Installers require a name parameter.
ERR_InvalidAppName=Error: Invalid Application name: {0}.
ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}.
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherBase.java Mon Apr 15 12:03:26 2019 -0400
+++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherBase.java Thu Apr 18 19:36:55 2019 -0400
@@ -132,7 +132,6 @@
try (PrintWriter out = new PrintWriter(new BufferedWriter(
new FileWriter("sl.properties")))) {
- out.println("name=test2");
out.println("arguments=" + argumentsMap);
out.println("java-options=" + vmArgumentsMap);
}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherModuleTest.java Mon Apr 15 12:03:26 2019 -0400
+++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherModuleTest.java Thu Apr 18 19:36:55 2019 -0400
@@ -39,7 +39,7 @@
"--name", "test",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input",
- "--add-launcher", "sl.properties"};
+ "--add-launcher", "test2=sl.properties"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloModule();
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherTest.java Mon Apr 15 12:03:26 2019 -0400
+++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherTest.java Thu Apr 18 19:36:55 2019 -0400
@@ -40,7 +40,7 @@
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--add-launcher", "sl.properties"};
+ "--add-launcher", "test2=sl.properties"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloImageJar();