--- a/src/demo/share/jpackage/JNLPConverter/src/jnlp/converter/JNLPConverter.java Thu Mar 28 08:08:07 2019 -0700
+++ b/src/demo/share/jpackage/JNLPConverter/src/jnlp/converter/JNLPConverter.java Thu Mar 28 13:47:40 2019 -0400
@@ -606,7 +606,7 @@
}
}
- launchArgs.add("--jvm-args");
+ launchArgs.add("--java-options");
if (Platform.isWindows()) {
if (jvmArgsStr.contains(" ")) {
if (jvmArgsStr.contains("\"")) {
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/Info.plist.template Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/Info.plist.template Thu Mar 28 13:47:40 2019 -0400
@@ -42,7 +42,7 @@
<string>DEPLOY_MAIN_JAR_NAME</string>
<key>JVMPreferencesID</key>
<string>DEPLOY_PREFERENCES_ID</string>
- <key>JVMOptions</key>
+ <key>JavaOptions</key>
<array>
DEPLOY_JVM_OPTIONS
</array>
--- a/src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm Thu Mar 28 13:47:40 2019 -0400
@@ -410,13 +410,13 @@
// jvmargs
AppendPListArrayToIniFile(infoDictionary, result,
- keys[CONFIG_SECTION_JVMOPTIONS]);
+ keys[CONFIG_SECTION_JAVAOPTIONS]);
// Generate AppCDS Cache
AppendPListDictionaryToIniFile(infoDictionary, result,
- keys[CONFIG_SECTION_APPCDSJVMOPTIONS]);
+ keys[CONFIG_SECTION_APPCDSJAVAOPTIONS]);
AppendPListDictionaryToIniFile(infoDictionary, result,
- keys[CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS]);
+ keys[CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS]);
// args
AppendPListArrayToIniFile(infoDictionary, result,
@@ -499,12 +499,12 @@
keys.insert(std::map<TString, TString>::value_type(
CONFIG_SECTION_APPLICATION, _T("Application")));
keys.insert(std::map<TString, TString>::value_type(
- CONFIG_SECTION_JVMOPTIONS, _T("JVMOptions")));
+ CONFIG_SECTION_JAVAOPTIONS, _T("JavaOptions")));
keys.insert(std::map<TString, TString>::value_type(
- CONFIG_SECTION_APPCDSJVMOPTIONS, _T("AppCDSJVMOptions")));
+ CONFIG_SECTION_APPCDSJAVAOPTIONS, _T("AppCDSJavaOptions")));
keys.insert(std::map<TString, TString>::value_type(
- CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS,
- _T("AppCDSGenerateCacheJVMOptions")));
+ CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS,
+ _T("AppCDSGenerateCacheJavaOptions")));
keys.insert(std::map<TString, TString>::value_type(
CONFIG_SECTION_ARGOPTIONS, _T("ArgOptions")));
}
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Thu Mar 28 13:47:40 2019 -0400
@@ -233,7 +233,7 @@
}
out.println();
- out.println("[JVMOptions]");
+ out.println("[JavaOptions]");
List<String> jvmargs = JVM_OPTIONS.fetchFrom(params);
for (String arg : jvmargs) {
out.println(arg);
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java Thu Mar 28 13:47:40 2019 -0400
@@ -57,7 +57,7 @@
* main-class
* icon
* arguments
- * jvm-args
+ * java-options
* win-console
*
*/
@@ -119,9 +119,9 @@
CLIOptions.ARGUMENTS.getId(),
Arguments.getArgumentList(argumentStr));
- String jvmargsStr = getOptionValue(CLIOptions.JVM_ARGS);
+ String jvmargsStr = getOptionValue(CLIOptions.JAVA_OPTIONS);
putUnlessNullOrEmpty(bundleParams,
- CLIOptions.JVM_ARGS.getId(),
+ CLIOptions.JAVA_OPTIONS.getId(),
Arguments.getArgumentList(jvmargsStr));
}
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Thu Mar 28 13:47:40 2019 -0400
@@ -228,9 +228,9 @@
VERSION ("app-version", OptionCategories.PROPERTY),
- JVM_ARGS ("jvm-args", OptionCategories.PROPERTY, () -> {
+ JAVA_OPTIONS ("java-options", OptionCategories.PROPERTY, () -> {
List<String> args = getArgumentList(popArg());
- args.forEach(a -> setOptionValue("jvm-args", a));
+ args.forEach(a -> setOptionValue("java-options", a));
}),
FILE_ASSOCIATIONS ("file-associations",
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Thu Mar 28 13:47:40 2019 -0400
@@ -231,7 +231,7 @@
@SuppressWarnings("unchecked")
static final StandardBundlerParam<List<String>> JVM_OPTIONS =
new StandardBundlerParam<>(
- Arguments.CLIOptions.JVM_ARGS.getId(),
+ Arguments.CLIOptions.JAVA_OPTIONS.getId(),
(Class<List<String>>) (Object) List.class,
params -> Collections.emptyList(),
(s, p) -> Arrays.asList(s.split("\n\n"))
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java Thu Mar 28 13:47:40 2019 -0400
@@ -81,7 +81,7 @@
options.put(CLIOptions.APPCLASS.getId(), USE.LAUNCHER);
options.put(CLIOptions.ICON.getId(), USE.LAUNCHER);
options.put(CLIOptions.ARGUMENTS.getId(), USE.LAUNCHER);
- options.put(CLIOptions.JVM_ARGS.getId(), USE.LAUNCHER);
+ options.put(CLIOptions.JAVA_OPTIONS.getId(), USE.LAUNCHER);
options.put(CLIOptions.ADD_LAUNCHER.getId(), USE.LAUNCHER);
options.put(CLIOptions.INSTALLER_TYPE.getId(), USE.INSTALL);
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Thu Mar 28 13:47:40 2019 -0400
@@ -126,15 +126,15 @@
\ Path to a Properties file that contains 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", "jvm-args",\n\
+\ "main-jar", "main-class", "arguments", "java-options",\n\
\ "app-version", "icon", and "win-console" can be used.\n\
\ These options are added to, or used to overwrite, the original\n\
\ command line options when building an additional launcher.\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\
-\ --jvm-args <java vm arguments>\n\
-\ Java arguments to pass to the virtual machine\n\
+\ --java-options <java options>\n\
+\ Options to pass to the Java runtime\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\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Thu Mar 28 13:47:40 2019 -0400
@@ -126,15 +126,15 @@
\ Path to a Properties file that contains 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", "jvm-args",\n\
+\ "main-jar", "main-class", "arguments", "java-options",\n\
\ "app-version", "icon", and "win-console" can be used.\n\
\ These options are added to, or used to overwrite, the original\n\
\ command line options when building an additional launcher.\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\
-\ --jvm-args <java vm arguments>\n\
-\ Java arguments to pass to the virtual machine\n\
+\ --java-options <java options>\n\
+\ Options to pass to the Java runtime\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\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Thu Mar 28 13:47:40 2019 -0400
@@ -126,15 +126,15 @@
\ Path to a Properties file that contains 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", "jvm-args",\n\
+\ "main-jar", "main-class", "arguments", "java-options",\n\
\ "app-version", "icon", and "win-console" can be used.\n\
\ These options are added to, or used to overwrite, the original\n\
\ command line options when building an additional launcher.\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\
-\ --jvm-args <java vm arguments>\n\
-\ Java arguments to pass to the virtual machine\n\
+\ --java-options <java options>\n\
+\ Options to pass to the Java runtime\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\
--- a/src/jdk.jpackage/share/native/libapplauncher/Helpers.cpp Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/native/libapplauncher/Helpers.cpp Thu Mar 28 13:47:40 2019 -0400
@@ -198,10 +198,10 @@
AppendToIni(propertyFile, Container, keys[CONFIG_APP_MEMORY]);
AppendToIni(propertyFile, Container, keys[CONFIG_SPLASH_KEY]);
- // JVMOptions Section
+ // JavaOptions Section
OrderedMap<TString, TString> JVMArgs =
Helpers::GetJVMArgsFromConfig(&propertyFile);
- Container->AppendSection(keys[CONFIG_SECTION_JVMOPTIONS], JVMArgs);
+ Container->AppendSection(keys[CONFIG_SECTION_JAVAOPTIONS], JVMArgs);
// ArgOptions Section
std::list<TString> args = Helpers::GetArgsFromConfig(&propertyFile);
--- a/src/jdk.jpackage/share/native/libapplauncher/Package.cpp Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/native/libapplauncher/Package.cpp Thu Mar 28 13:47:40 2019 -0400
@@ -192,8 +192,8 @@
// -> cdsUninitialized
// -> cdsGenCache If -Xappcds:generatecache
// -> cdsDisabled If -Xappcds:off
-// -> cdsEnabled If "AppCDSJVMOptions" section is present
-// -> cdsAuto If "AppCDSJVMOptions" section is present and
+// -> cdsEnabled If "AppCDSJavaOptions" section is present
+// -> cdsAuto If "AppCDSJavaOptions" section is present and
// app.appcds.cache=auto
// -> cdsDisabled Default
//
@@ -213,7 +213,7 @@
case cdsUninitialized: {
if (Config->ContainsSection(
- keys[CONFIG_SECTION_APPCDSJVMOPTIONS]) == true) {
+ keys[CONFIG_SECTION_APPCDSJAVAOPTIONS]) == true) {
// If the AppCDS section is present then enable AppCDS.
TString appCDSCacheValue;
@@ -248,21 +248,21 @@
}
case cdsDisabled: {
- Config->GetSection(keys[CONFIG_SECTION_JVMOPTIONS],
+ Config->GetSection(keys[CONFIG_SECTION_JAVAOPTIONS],
FBootFields->FJVMArgs);
break;
}
case cdsGenCache: {
Config->GetSection(keys[
- CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS],
+ CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS],
FBootFields->FJVMArgs);
break;
}
case cdsAuto:
case cdsEnabled: {
- if (Config->GetValue(keys[CONFIG_SECTION_APPCDSJVMOPTIONS],
+ if (Config->GetValue(keys[CONFIG_SECTION_APPCDSJAVAOPTIONS],
_T( "-XX:SharedArchiveFile"),
FBootFields->FAppCDSCacheFileName) == true) {
// File names may contain the incorrect path separators.
@@ -275,13 +275,13 @@
FilePath::FixPathForPlatform(
FBootFields->FAppCDSCacheFileName);
iniConfig->SetValue(keys[
- CONFIG_SECTION_APPCDSJVMOPTIONS],
+ CONFIG_SECTION_APPCDSJAVAOPTIONS],
_T( "-XX:SharedArchiveFile"),
FBootFields->FAppCDSCacheFileName);
}
}
- Config->GetSection(keys[CONFIG_SECTION_APPCDSJVMOPTIONS],
+ Config->GetSection(keys[CONFIG_SECTION_APPCDSJAVAOPTIONS],
FBootFields->FJVMArgs);
}
--- a/src/jdk.jpackage/share/native/libapplauncher/Platform.cpp Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/native/libapplauncher/Platform.cpp Thu Mar 28 13:47:40 2019 -0400
@@ -159,14 +159,14 @@
TString>::value_type(CONFIG_SECTION_APPLICATION,
_T("Application")));
keys.insert(std::map<TString,
- TString>::value_type(CONFIG_SECTION_JVMOPTIONS,
- _T("JVMOptions")));
+ TString>::value_type(CONFIG_SECTION_JAVAOPTIONS,
+ _T("JavaOptions")));
keys.insert(std::map<TString,
- TString>::value_type(CONFIG_SECTION_APPCDSJVMOPTIONS,
- _T("AppCDSJVMOptions")));
+ TString>::value_type(CONFIG_SECTION_APPCDSJAVAOPTIONS,
+ _T("AppCDSJavaOptions")));
keys.insert(std::map<TString,
- TString>::value_type(CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS,
- _T("AppCDSGenerateCacheJVMOptions")));
+ TString>::value_type(CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS,
+ _T("AppCDSGenerateCacheJavaOptions")));
keys.insert(std::map<TString,
TString>::value_type(CONFIG_SECTION_ARGOPTIONS,
_T("ArgOptions")));
--- a/src/jdk.jpackage/share/native/libapplauncher/Platform.h Thu Mar 28 08:08:07 2019 -0700
+++ b/src/jdk.jpackage/share/native/libapplauncher/Platform.h Thu Mar 28 13:47:40 2019 -0400
@@ -43,12 +43,12 @@
using namespace std;
// Config file sections
-#define CONFIG_SECTION_APPLICATION _T("CONFIG_SECTION_APPLICATION")
-#define CONFIG_SECTION_JVMOPTIONS _T("CONFIG_SECTION_JVMOPTIONS")
-#define CONFIG_SECTION_APPCDSJVMOPTIONS _T("CONFIG_SECTION_APPCDSJVMOPTIONS")
-#define CONFIG_SECTION_ARGOPTIONS _T("CONFIG_SECTION_ARGOPTIONS")
-#define CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS \
- _T("CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS")
+#define CONFIG_SECTION_APPLICATION _T("CONFIG_SECTION_APPLICATION")
+#define CONFIG_SECTION_JAVAOPTIONS _T("CONFIG_SECTION_JAVAOPTIONS")
+#define CONFIG_SECTION_APPCDSJAVAOPTIONS _T("CONFIG_SECTION_APPCDSJAVAOPTIONS")
+#define CONFIG_SECTION_ARGOPTIONS _T("CONFIG_SECTION_ARGOPTIONS")
+#define CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS \
+ _T("CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS")
// Config file keys.
#define CONFIG_VERSION _T("CONFIG_VERSION")
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherBase.java Thu Mar 28 08:08:07 2019 -0700
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherBase.java Thu Mar 28 13:47:40 2019 -0400
@@ -134,7 +134,7 @@
new FileWriter("sl.properties")))) {
out.println("name=test2");
out.println("arguments=" + argumentsMap);
- out.println("jvm-args=" + vmArgumentsMap);
+ out.println("java-options=" + vmArgumentsMap);
}
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsBase.java Thu Mar 28 08:08:07 2019 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateImageJVMArgsBase {
-
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
- private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
-
- private static final String ARGUMENT1 = "-Dparam1=Some Param 1";
- private static final String ARGUMENT2 = "-Dparam2=Some \"Param\" 2";
- private static final String ARGUMENT3 =
- "-Dparam3=Some \"Param\" with \" 3";
-
- private static final List<String> arguments = new ArrayList<>();
-
- private static void initArguments(boolean toolProvider, String [] cmd) {
- if (arguments.isEmpty()) {
- arguments.add(ARGUMENT1);
- arguments.add(ARGUMENT2);
- arguments.add(ARGUMENT3);
- }
-
- String argumentsMap = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
- cmd[cmd.length - 1] = argumentsMap;
- }
-
- private static void initArguments2(boolean toolProvider, String [] cmd) {
- int index = cmd.length - 6;
-
- cmd[index++] = "--jvm-args";
- arguments.clear();
- arguments.add(ARGUMENT1);
- cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
-
- cmd[index++] = "--jvm-args";
- arguments.clear();
- arguments.add(ARGUMENT2);
- cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
-
- cmd[index++] = "--jvm-args";
- arguments.clear();
- arguments.add(ARGUMENT3);
- cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
-
- arguments.clear();
- arguments.add(ARGUMENT1);
- arguments.add(ARGUMENT2);
- arguments.add(ARGUMENT3);
- }
-
- private static void validateResult(String[] result, List<String> args)
- throws Exception {
- if (result.length != (args.size() + 2)) {
- for (String r : result) {
- System.err.println(r.trim());
- }
- throw new AssertionError("Unexpected number of lines: "
- + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- int index = 2;
- for (String arg : args) {
- if (!result[index].trim().equals(arg)) {
- throw new AssertionError("Unexpected result[" + index + "]: "
- + result[index]);
- }
- index++;
- }
- }
-
- private static void validate(List<String> expectedArgs) throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError("Test application exited with error: "
- + retVal);
- }
-
- File outfile = new File(appWorkingDir + File.separator + appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result, expectedArgs);
- }
-
- public static void testCreateImageJVMArgs(String [] cmd) throws Exception {
- initArguments(false, cmd);
- JPackageHelper.executeCLI(true, cmd);
- validate(arguments);
- }
-
- public static void testCreateImageJVMArgsToolProvider(String [] cmd) throws Exception {
- initArguments(true, cmd);
- JPackageHelper.executeToolProvider(true, cmd);
- validate(arguments);
- }
-
- public static void testCreateImageJVMArgs2(String [] cmd) throws Exception {
- initArguments2(false, cmd);
- JPackageHelper.executeCLI(true, cmd);
- validate(arguments);
- }
-
- public static void testCreateImageJVMArgs2ToolProvider(String [] cmd) throws Exception {
- initArguments2(true, cmd);
- JPackageHelper.executeToolProvider(true, cmd);
- validate(arguments);
- }
-}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsModuleTest.java Thu Mar 28 08:08:07 2019 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image with --jvm-args test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateImageJVMArgsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateImageJVMArgsModuleTest
- */
-public class JPackageCreateImageJVMArgsModuleTest {
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "create-image",
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--jvm-args", "TBD"};
-
- private static final String[] CMD2 = {
- "create-image",
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--jvm-args", "TBD",
- "--jvm-args", "TBD",
- "--jvm-args", "TBD"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
-
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgsToolProvider(CMD);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2ToolProvider(CMD2);
- }
-
-}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsTest.java Thu Mar 28 08:08:07 2019 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image with --jvm-args test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateImageJVMArgsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateImageJVMArgsTest
- */
-public class JPackageCreateImageJVMArgsTest {
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "create-image",
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--files", "hello.jar",
- "--jvm-args", "TBD"};
-
- private static final String[] CMD2 = {
- "create-image",
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--files", "hello.jar",
- "--jvm-args", "TBD",
- "--jvm-args", "TBD",
- "--jvm-args", "TBD"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgsToolProvider(CMD);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2ToolProvider(CMD2);
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsBase.java Thu Mar 28 13:47:40 2019 -0400
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class JPackageCreateImageJavaOptionsBase {
+
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+ private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
+
+ private static final String ARGUMENT1 = "-Dparam1=Some Param 1";
+ private static final String ARGUMENT2 = "-Dparam2=Some \"Param\" 2";
+ private static final String ARGUMENT3 =
+ "-Dparam3=Some \"Param\" with \" 3";
+
+ private static final List<String> arguments = new ArrayList<>();
+
+ private static void initArguments(boolean toolProvider, String [] cmd) {
+ if (arguments.isEmpty()) {
+ arguments.add(ARGUMENT1);
+ arguments.add(ARGUMENT2);
+ arguments.add(ARGUMENT3);
+ }
+
+ String argumentsMap = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+ cmd[cmd.length - 1] = argumentsMap;
+ }
+
+ private static void initArguments2(boolean toolProvider, String [] cmd) {
+ int index = cmd.length - 6;
+
+ cmd[index++] = "--java-options";
+ arguments.clear();
+ arguments.add(ARGUMENT1);
+ cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+
+ cmd[index++] = "--java-options";
+ arguments.clear();
+ arguments.add(ARGUMENT2);
+ cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+
+ cmd[index++] = "--java-options";
+ arguments.clear();
+ arguments.add(ARGUMENT3);
+ cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+
+ arguments.clear();
+ arguments.add(ARGUMENT1);
+ arguments.add(ARGUMENT2);
+ arguments.add(ARGUMENT3);
+ }
+
+ private static void validateResult(String[] result, List<String> args)
+ throws Exception {
+ if (result.length != (args.size() + 2)) {
+ for (String r : result) {
+ System.err.println(r.trim());
+ }
+ throw new AssertionError("Unexpected number of lines: "
+ + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ int index = 2;
+ for (String arg : args) {
+ if (!result[index].trim().equals(arg)) {
+ throw new AssertionError("Unexpected result[" + index + "]: "
+ + result[index]);
+ }
+ index++;
+ }
+ }
+
+ private static void validate(List<String> expectedArgs) throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError("Test application exited with error: "
+ + retVal);
+ }
+
+ File outfile = new File(appWorkingDir + File.separator + appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result, expectedArgs);
+ }
+
+ public static void testCreateImageJavaOptions(String [] cmd) throws Exception {
+ initArguments(false, cmd);
+ JPackageHelper.executeCLI(true, cmd);
+ validate(arguments);
+ }
+
+ public static void testCreateImageJavaOptionsToolProvider(String [] cmd) throws Exception {
+ initArguments(true, cmd);
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(arguments);
+ }
+
+ public static void testCreateImageJavaOptions2(String [] cmd) throws Exception {
+ initArguments2(false, cmd);
+ JPackageHelper.executeCLI(true, cmd);
+ validate(arguments);
+ }
+
+ public static void testCreateImageJavaOptions2ToolProvider(String [] cmd) throws Exception {
+ initArguments2(true, cmd);
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(arguments);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsModuleTest.java Thu Mar 28 13:47:40 2019 -0400
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image with --java-options test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageCreateImageJavaOptionsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateImageJavaOptionsModuleTest
+ */
+public class JPackageCreateImageJavaOptionsModuleTest {
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "create-image",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--java-options", "TBD"};
+
+ private static final String[] CMD2 = {
+ "create-image",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--java-options", "TBD",
+ "--java-options", "TBD",
+ "--java-options", "TBD"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptionsToolProvider(CMD);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2ToolProvider(CMD2);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsTest.java Thu Mar 28 13:47:40 2019 -0400
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image with --java-options test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageCreateImageJavaOptionsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateImageJavaOptionsTest
+ */
+public class JPackageCreateImageJavaOptionsTest {
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "create-image",
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--files", "hello.jar",
+ "--java-options", "TBD"};
+
+ private static final String[] CMD2 = {
+ "create-image",
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--files", "hello.jar",
+ "--java-options", "TBD",
+ "--java-options", "TBD",
+ "--java-options", "TBD"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptionsToolProvider(CMD);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2ToolProvider(CMD2);
+ }
+
+}