< prev index next >

src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AddLauncherArguments.java

Print this page

        

*** 21,37 **** * 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. */ ! package jdk.jpackage.internal; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.io.File; ! import jdk.jpackage.internal.Arguments.CLIOptions; /* * AddLauncherArguments * * Processes a add-launcher properties file to create the Map of --- 21,37 ---- * 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. */ ! package jdk.incubator.jpackage.internal; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.io.File; ! import jdk.incubator.jpackage.internal.Arguments.CLIOptions; /* * AddLauncherArguments * * Processes a add-launcher properties file to create the Map of
*** 49,65 **** * * The add-launcher properties file may have any of: * * appVersion * module - * add-modules * main-jar * main-class * icon * arguments * java-options * win-console * */ class AddLauncherArguments { private final String name; --- 49,65 ---- * * The add-launcher properties file may have any of: * * appVersion * module * main-jar * main-class * icon * arguments * java-options * win-console + * linux-app-category * */ class AddLauncherArguments { private final String name;
*** 102,133 **** getOptionValue(CLIOptions.NAME)); putUnlessNull(bundleParams, CLIOptions.VERSION.getId(), getOptionValue(CLIOptions.VERSION)); ! putUnlessNull(bundleParams, ! CLIOptions.ADD_MODULES.getId(), ! getOptionValue(CLIOptions.ADD_MODULES)); putUnlessNull(bundleParams, CLIOptions.WIN_CONSOLE_HINT.getId(), getOptionValue(CLIOptions.WIN_CONSOLE_HINT)); String value = getOptionValue(CLIOptions.ICON); putUnlessNull(bundleParams, CLIOptions.ICON.getId(), (value == null) ? null : new File(value)); String argumentStr = getOptionValue(CLIOptions.ARGUMENTS); ! putUnlessNullOrEmpty(bundleParams, ! CLIOptions.ARGUMENTS.getId(), Arguments.getArgumentList(argumentStr)); String jvmargsStr = getOptionValue(CLIOptions.JAVA_OPTIONS); ! putUnlessNullOrEmpty(bundleParams, ! CLIOptions.JAVA_OPTIONS.getId(), Arguments.getArgumentList(jvmargsStr)); } private String getOptionValue(CLIOptions option) { if (option == null || allArgs == null) { return null; } --- 102,138 ---- getOptionValue(CLIOptions.NAME)); putUnlessNull(bundleParams, CLIOptions.VERSION.getId(), getOptionValue(CLIOptions.VERSION)); ! putUnlessNull(bundleParams, CLIOptions.RELEASE.getId(), ! getOptionValue(CLIOptions.RELEASE)); ! ! putUnlessNull(bundleParams, CLIOptions.LINUX_CATEGORY.getId(), ! getOptionValue(CLIOptions.LINUX_CATEGORY)); putUnlessNull(bundleParams, CLIOptions.WIN_CONSOLE_HINT.getId(), getOptionValue(CLIOptions.WIN_CONSOLE_HINT)); String value = getOptionValue(CLIOptions.ICON); putUnlessNull(bundleParams, CLIOptions.ICON.getId(), (value == null) ? null : new File(value)); + // "arguments" and "java-options" even if value is null: + if (allArgs.containsKey(CLIOptions.ARGUMENTS.getId())) { String argumentStr = getOptionValue(CLIOptions.ARGUMENTS); ! bundleParams.put(CLIOptions.ARGUMENTS.getId(), Arguments.getArgumentList(argumentStr)); + } + if (allArgs.containsKey(CLIOptions.JAVA_OPTIONS.getId())) { String jvmargsStr = getOptionValue(CLIOptions.JAVA_OPTIONS); ! bundleParams.put(CLIOptions.JAVA_OPTIONS.getId(), Arguments.getArgumentList(jvmargsStr)); } + } private String getOptionValue(CLIOptions option) { if (option == null || allArgs == null) { return null; }
*** 151,186 **** if (value != null) { params.put(param, value); } } - private void putUnlessNullOrEmpty(Map<String, ? super Object> params, - String param, Collection<?> value) { - if (value != null && !value.isEmpty()) { - params.put(param, value); - } - } - - private void putUnlessNullOrEmpty(Map<String, ? super Object> params, - String param, Map<?, ?> value) { - if (value != null && !value.isEmpty()) { - params.put(param, value); - } - } - static Map<String, ? super Object> merge( Map<String, ? super Object> original, Map<String, ? super Object> additional) { Map<String, ? super Object> tmp = new HashMap<>(original); ! if (additional.containsKey("module")) { ! tmp.remove("main-jar"); ! tmp.remove("main-class"); ! } else if (additional.containsKey("main-jar")) { ! tmp.remove("module"); ! // should we only remove add-modules when it wasn't actually passed ! // but was inferred or empty ? ! tmp.remove("add-modules"); } tmp.putAll(additional); return tmp; } --- 156,183 ---- if (value != null) { params.put(param, value); } } static Map<String, ? super Object> merge( Map<String, ? super Object> original, Map<String, ? super Object> additional) { Map<String, ? super Object> tmp = new HashMap<>(original); ! if (additional.containsKey(CLIOptions.MODULE.getId())) { ! tmp.remove(CLIOptions.MAIN_JAR.getId()); ! tmp.remove(CLIOptions.APPCLASS.getId()); ! } else if (additional.containsKey(CLIOptions.MAIN_JAR.getId())) { ! tmp.remove(CLIOptions.MODULE.getId()); ! } ! if (additional.containsKey(CLIOptions.ARGUMENTS.getId())) { ! // if add launcher properties file contains "arguments", even with ! // null value, disregard the "arguments" from command line ! tmp.remove(CLIOptions.ARGUMENTS.getId()); ! } ! if (additional.containsKey(CLIOptions.JAVA_OPTIONS.getId())) { ! // same thing for java-options ! tmp.remove(CLIOptions.JAVA_OPTIONS.getId()); } tmp.putAll(additional); return tmp; }
< prev index next >