author | herrick |
Thu, 28 Mar 2019 13:47:40 -0400 | |
branch | JDK-8200758-branch |
changeset 57291 | f2d429260ad4 |
parent 57259 | a84c657c713d |
child 57307 | 4948a1944cf9 |
permissions | -rw-r--r-- |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
1 |
/* |
57106
ea870b9ce89a
8216492: Update copyright of all new jpackage fils to 2019
kcr
parents:
57099
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
4 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
10 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
15 |
* accompanied this code). |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
16 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
20 |
* |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
23 |
* questions. |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
24 |
*/ |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
25 |
|
57039 | 26 |
package jdk.jpackage.internal; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
27 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
28 |
import java.util.Collection; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
29 |
import java.util.HashMap; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
30 |
import java.util.Map; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
31 |
import java.io.File; |
57039 | 32 |
import jdk.jpackage.internal.Arguments.CLIOptions; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
33 |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
34 |
/* |
57256 | 35 |
* AddLauncherArguments |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
36 |
* |
57256 | 37 |
* Processes a add-launcher properties file to create the Map of |
38 |
* bundle params applicable to the add-launcher: |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
39 |
* |
57256 | 40 |
* BundlerParams p = (new AddLauncherArguments(file)).getLauncherMap(); |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
41 |
* |
57256 | 42 |
* A add-launcher is another executable program generated by either the |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
43 |
* create-image mode or the create-installer mode. |
57256 | 44 |
* The add-launcher may be the same program with different configuration, |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
45 |
* or a completely different program created from the same files. |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
46 |
* |
57256 | 47 |
* There may be multiple add-launchers, each created by using the |
48 |
* command line arg "--add-launcher <file path> |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
49 |
* |
57256 | 50 |
* The add-launcher properties file may have any of: |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
51 |
* |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
52 |
* name (required) |
57256 | 53 |
* appVersion |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
54 |
* module |
57256 | 55 |
* add-modules |
56 |
* main-jar |
|
57 |
* main-class |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
58 |
* icon |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
59 |
* arguments |
57291 | 60 |
* java-options |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
61 |
* win-console |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
62 |
* |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
63 |
*/ |
57256 | 64 |
class AddLauncherArguments { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
65 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
66 |
private final String filename; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
67 |
private Map<String, String> allArgs; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
68 |
private Map<String, ? super Object> bundleParams; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
69 |
|
57256 | 70 |
AddLauncherArguments(String filename) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
71 |
this.filename = filename; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
72 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
73 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
74 |
private void initLauncherMap() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
75 |
if (bundleParams != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
76 |
return; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
77 |
} |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
78 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
79 |
allArgs = Arguments.getPropertiesFromFile(filename); |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
80 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
81 |
bundleParams = new HashMap<>(); |
57256 | 82 |
String mainJar = getOptionValue(CLIOptions.MAIN_JAR); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
83 |
String mainClass = getOptionValue(CLIOptions.APPCLASS); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
84 |
String module = getOptionValue(CLIOptions.MODULE); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
85 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
86 |
if (module != null && mainClass != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
87 |
putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
88 |
module + "/" + mainClass); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
89 |
} else if (module != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
90 |
putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
91 |
module); |
57256 | 92 |
} else { |
93 |
putUnlessNull(bundleParams, Arguments.CLIOptions.MAIN_JAR.getId(), |
|
94 |
mainJar); |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
95 |
putUnlessNull(bundleParams, Arguments.CLIOptions.APPCLASS.getId(), |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
96 |
mainClass); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
97 |
} |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
98 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
99 |
putUnlessNull(bundleParams, Arguments.CLIOptions.NAME.getId(), |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56849
diff
changeset
|
100 |
getOptionValue(CLIOptions.NAME)); |
57256 | 101 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
102 |
putUnlessNull(bundleParams, Arguments.CLIOptions.VERSION.getId(), |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56849
diff
changeset
|
103 |
getOptionValue(CLIOptions.VERSION)); |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
104 |
|
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56849
diff
changeset
|
105 |
putUnlessNull(bundleParams, |
57256 | 106 |
Arguments.CLIOptions.ADD_MODULES.getId(), |
107 |
getOptionValue(CLIOptions.ADD_MODULES)); |
|
108 |
||
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56957
diff
changeset
|
109 |
putUnlessNull(bundleParams, |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56957
diff
changeset
|
110 |
Arguments.CLIOptions.WIN_CONSOLE_HINT.getId(), |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
111 |
getOptionValue(CLIOptions.WIN_CONSOLE_HINT)); |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56982
diff
changeset
|
112 |
|
56849
16c34c7b4147
8208579: [jpackager] --secondary-launcher arg fails when properties file has no icon
herrick
parents:
56821
diff
changeset
|
113 |
String value = getOptionValue(CLIOptions.ICON); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
114 |
putUnlessNull(bundleParams, Arguments.CLIOptions.ICON.getId(), |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56849
diff
changeset
|
115 |
(value == null) ? null : new File(value)); |
56957
2f01969ed7cb
8211299: Output of System.out is not printed to CMD on Windows
herrick
parents:
56933
diff
changeset
|
116 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
117 |
String argumentStr = getOptionValue(CLIOptions.ARGUMENTS); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
118 |
putUnlessNullOrEmpty(bundleParams, |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
119 |
CLIOptions.ARGUMENTS.getId(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
120 |
Arguments.getArgumentList(argumentStr)); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
121 |
|
57291 | 122 |
String jvmargsStr = getOptionValue(CLIOptions.JAVA_OPTIONS); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
123 |
putUnlessNullOrEmpty(bundleParams, |
57291 | 124 |
CLIOptions.JAVA_OPTIONS.getId(), |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
125 |
Arguments.getArgumentList(jvmargsStr)); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
126 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
127 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
128 |
private String getOptionValue(CLIOptions option) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
129 |
if (option == null || allArgs == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
130 |
return null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
131 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
132 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
133 |
String id = option.getId(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
134 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
135 |
if (allArgs.containsKey(id)) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
136 |
return allArgs.get(id); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
137 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
138 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
139 |
return null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
140 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
141 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57039
diff
changeset
|
142 |
Map<String, ? super Object> getLauncherMap() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
143 |
initLauncherMap(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
144 |
return bundleParams; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
145 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
146 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
147 |
private void putUnlessNull(Map<String, ? super Object> params, |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
148 |
String param, Object value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
149 |
if (value != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
150 |
params.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
151 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
152 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
153 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
154 |
private void putUnlessNullOrEmpty(Map<String, ? super Object> params, |
57015
5d2008115309
JDK-8213244: Fix all warnings in jpackager java code
herrick
parents:
56994
diff
changeset
|
155 |
String param, Collection<?> value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
156 |
if (value != null && !value.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
157 |
params.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
158 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
159 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
160 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
161 |
private void putUnlessNullOrEmpty(Map<String, ? super Object> params, |
57015
5d2008115309
JDK-8213244: Fix all warnings in jpackager java code
herrick
parents:
56994
diff
changeset
|
162 |
String param, Map<?, ?> value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
163 |
if (value != null && !value.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
164 |
params.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
165 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
166 |
} |
57259
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
167 |
|
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
168 |
static Map<String, ? super Object> merge( |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
169 |
Map<String, ? super Object> original, |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
170 |
Map<String, ? super Object> additional) { |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
171 |
Map<String, ? super Object> tmp = new HashMap<>(original); |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
172 |
if (additional.containsKey("module")) { |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
173 |
tmp.remove("main-jar"); |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
174 |
tmp.remove("main-class"); |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
175 |
} else if (additional.containsKey("main-jar")) { |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
176 |
tmp.remove("module"); |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
177 |
// should we only remove add-modules when it wasn't actually passed |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
178 |
// but was inferred or empty ? |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
179 |
tmp.remove("add-modules"); |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
180 |
} |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
181 |
tmp.putAll(additional); |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
182 |
return tmp; |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
183 |
} |
a84c657c713d
8171959: add-launcher is not working when normal jar is used for first launcher and module is used for second launcher
herrick
parents:
57256
diff
changeset
|
184 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
185 |
} |