author | herrick |
Thu, 21 Mar 2019 13:46:28 -0400 | |
branch | JDK-8200758-branch |
changeset 57276 | eac9018748b3 |
parent 57256 | d7c27451f759 |
child 57314 | 23da9e6f446f |
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) 2011, 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.io.File; |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
29 |
import java.nio.file.Files; |
57119 | 30 |
import java.nio.file.Path; |
31 |
import java.nio.file.InvalidPathException; |
|
57080 | 32 |
import java.text.MessageFormat; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
34 |
import java.util.Arrays; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
35 |
import java.util.Collection; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
36 |
import java.util.LinkedHashMap; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
37 |
import java.util.LinkedHashSet; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
38 |
import java.util.LinkedList; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
39 |
import java.util.List; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
40 |
import java.util.Map; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
41 |
import java.util.Set; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
42 |
import java.util.TreeMap; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
43 |
import java.util.TreeSet; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
44 |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
45 |
/** |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
46 |
* DeployParams |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
47 |
* |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
48 |
* This class is generated and used in Arguments.processArguments() as |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
49 |
* intermediate step in generating the BundleParams and ultimately the Bundles |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
50 |
*/ |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
51 |
public class DeployParams { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
52 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
53 |
final List<RelativeFileSet> resources = new ArrayList<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
54 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
55 |
String id; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
56 |
String vendor; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
57 |
String email; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
58 |
String description; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
59 |
String licenseType; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
60 |
String copyright; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
61 |
String version; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
62 |
Boolean systemWide; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
63 |
Boolean serviceHint; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
64 |
Boolean signBundle; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
65 |
Boolean installdirChooser; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
66 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
67 |
String applicationClass; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
68 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
69 |
List<Param> params; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
70 |
List<String> arguments; //unnamed arguments |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
71 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
72 |
// Java 9 modules support |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
73 |
String addModules = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
74 |
String limitModules = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
75 |
String modulePath = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
76 |
String module = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
77 |
String debugPort = null; |
56902
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
78 |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
79 |
File outdir = null; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
80 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
81 |
String appId = null; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
82 |
|
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
83 |
// list of jvm args |
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
84 |
// (in theory string can contain spaces and need to be escaped |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
85 |
List<String> jvmargs = new LinkedList<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
86 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
87 |
// raw arguments to the bundler |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
88 |
Map<String, ? super Object> bundlerArguments = new LinkedHashMap<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
89 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
90 |
void setLicenseType(String licenseType) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
91 |
this.licenseType = licenseType; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
92 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
93 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
94 |
void setCopyright(String copyright) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
95 |
this.copyright = copyright; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
96 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
97 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
98 |
void setVersion(String version) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
99 |
this.version = version; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
100 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
101 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
102 |
void setSystemWide(Boolean systemWide) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
103 |
this.systemWide = systemWide; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
104 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
105 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
106 |
void setInstalldirChooser(Boolean installdirChooser) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
107 |
this.installdirChooser = installdirChooser; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
108 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
109 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
110 |
void setSignBundle(Boolean signBundle) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
111 |
this.signBundle = signBundle; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
112 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
113 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
114 |
void addJvmArg(String v) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
115 |
jvmargs.add(v); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
116 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
117 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
118 |
void setArguments(List<String> args) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
119 |
this.arguments = args; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
120 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
121 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
122 |
List<String> getArguments() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
123 |
return this.arguments; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
124 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
125 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
126 |
void addArgument(String arg) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
127 |
this.arguments.add(arg); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
128 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
129 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
130 |
void addAddModule(String value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
131 |
if (addModules == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
132 |
addModules = value; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
133 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
134 |
else { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
135 |
addModules += "," + value; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
136 |
} |
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 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
139 |
void addLimitModule(String value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
140 |
if (limitModules == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
141 |
limitModules = value; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
142 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
143 |
else { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
144 |
limitModules += "," + value; |
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 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
148 |
String getModulePath() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
149 |
return this.modulePath; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
150 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
151 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
152 |
void setModulePath(String value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
153 |
this.modulePath = value; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
154 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
155 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
156 |
void setModule(String value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
157 |
this.module = 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 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
160 |
void setDebug(String value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
161 |
this.debugPort = value; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
162 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
163 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
164 |
void setDescription(String description) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
165 |
this.description = description; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
166 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
167 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
168 |
public void setAppId(String id) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
169 |
appId = id; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
170 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
171 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
172 |
void setParams(List<Param> params) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
173 |
this.params = params; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
174 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
175 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
176 |
void setVendor(String vendor) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
177 |
this.vendor = vendor; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
178 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
179 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
180 |
void setEmail(String email) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
181 |
this.email = email; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
182 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
183 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
184 |
void setApplicationClass(String applicationClass) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
185 |
this.applicationClass = applicationClass; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
186 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
187 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
188 |
File getOutput() { |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
189 |
return outdir; |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
190 |
} |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
191 |
|
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
192 |
public void setOutput(File output) { |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
193 |
outdir = output; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
194 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
195 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
196 |
static class Template { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
197 |
File in; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
198 |
File out; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
199 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
200 |
Template(File in, File out) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
201 |
this.in = in; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
202 |
this.out = out; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
203 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
204 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
205 |
|
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
206 |
// we need to expand as in some cases |
57039 | 207 |
// (most notably jpackage) |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
208 |
// we may get "." as filename and assumption is we include |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
209 |
// everything in the given folder |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
210 |
// (IOUtils.copyfiles() have recursive behavior) |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
211 |
List<File> expandFileset(File root) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
212 |
List<File> files = new LinkedList<>(); |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
213 |
if (!Files.isSymbolicLink(root.toPath())) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
214 |
if (root.isDirectory()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
215 |
File[] children = root.listFiles(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
216 |
if (children != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
217 |
for (File f : children) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
218 |
files.addAll(expandFileset(f)); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
219 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
220 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
221 |
} else { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
222 |
files.add(root); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
223 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
224 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
225 |
return files; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
226 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
227 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
228 |
public void addResource(File baseDir, String path) { |
57276
eac9018748b3
8220804: Help message for @ argfile option is printed in the wrong place
herrick
parents:
57256
diff
changeset
|
229 |
addResource(baseDir, new File(baseDir, path)); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
230 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
231 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
232 |
public void addResource(File baseDir, File file) { |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
233 |
// normalize initial file |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
234 |
// to strip things like "." in the path |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
235 |
// or it can confuse symlink detection logic |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
236 |
file = file.getAbsoluteFile(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
237 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
238 |
if (baseDir == null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
239 |
baseDir = file.getParentFile(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
240 |
} |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
241 |
resources.add(new RelativeFileSet( |
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
242 |
baseDir, new LinkedHashSet<>(expandFileset(file)))); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
243 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
244 |
|
57097
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
245 |
void setClasspath() { |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
246 |
String classpath = ""; |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
247 |
for (RelativeFileSet resource : resources) { |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
248 |
for (String file : resource.getIncludedFiles()) { |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
249 |
if (file.endsWith(".jar")) { |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
250 |
classpath += file + File.pathSeparator; |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
251 |
} |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
252 |
} |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
253 |
} |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
254 |
addBundleArgument( |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
255 |
StandardBundlerParam.CLASSPATH.getID(), classpath); |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
256 |
} |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
257 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
258 |
private static File createFile(final File baseDir, final String path) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
259 |
final File testFile = new File(path); |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
260 |
return testFile.isAbsolute() ? |
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
261 |
testFile : new File(baseDir == null ? |
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
262 |
null : baseDir.getAbsolutePath(), path); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
263 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
264 |
|
57119 | 265 |
static void validateName(String s, boolean forApp) |
266 |
throws PackagerException { |
|
57255
f686bda3b831
8215574: Investigate and document usage of --category, --copyright, --vendor and --description
herrick
parents:
57218
diff
changeset
|
267 |
|
57119 | 268 |
String exceptionKey = forApp ? |
269 |
"ERR_InvalidAppName" : "ERR_InvalidSLName"; |
|
57255
f686bda3b831
8215574: Investigate and document usage of --category, --copyright, --vendor and --description
herrick
parents:
57218
diff
changeset
|
270 |
|
57119 | 271 |
if (s == null) { |
272 |
if (forApp) { |
|
273 |
return; |
|
274 |
} else { |
|
275 |
throw new PackagerException(exceptionKey, s); |
|
276 |
} |
|
56985 | 277 |
} |
57119 | 278 |
if (s.length() == 0 || s.charAt(s.length() - 1) == '\\') { |
279 |
throw new PackagerException(exceptionKey, s); |
|
280 |
} |
|
281 |
try { |
|
282 |
// name must be valid path element for this file system |
|
283 |
Path p = (new File(s)).toPath(); |
|
284 |
// and it must be a single name element in a path |
|
285 |
if (p.getNameCount() != 1) { |
|
286 |
throw new PackagerException(exceptionKey, s); |
|
287 |
} |
|
288 |
} catch (InvalidPathException ipe) { |
|
289 |
throw new PackagerException(ipe, exceptionKey, s); |
|
56985 | 290 |
} |
291 |
||
292 |
for (int i = 0; i < s.length(); i++) { |
|
293 |
char a = s.charAt(i); |
|
294 |
// We check for ASCII codes first which we accept. If check fails, |
|
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
295 |
// check if it is acceptable extended ASCII or unicode character. |
57119 | 296 |
if (a < ' ' || a > '~') { |
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
297 |
// Accept anything else including special chars like copyright |
56985 | 298 |
// symbols. Note: space will be included by ASCII check above, |
57119 | 299 |
// but other whitespace like tabs or new line will be rejected. |
300 |
if (Character.isISOControl(a) || |
|
301 |
Character.isWhitespace(a)) { |
|
302 |
throw new PackagerException(exceptionKey, s); |
|
56985 | 303 |
} |
57119 | 304 |
} else if (a == '"' || a == '%') { |
305 |
throw new PackagerException(exceptionKey, s); |
|
56985 | 306 |
} |
307 |
} |
|
308 |
} |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
309 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
310 |
public void validate() throws PackagerException { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
311 |
if (outdir == null) { |
56848
f8a7c83f31f1
JDK-8208456: [packager] Remove some unused Strings
herrick
parents:
56836
diff
changeset
|
312 |
throw new PackagerException("ERR_MissingArgument", "--output"); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
313 |
} |
56888
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
314 |
|
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
315 |
boolean hasModule = (bundlerArguments.get( |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
316 |
Arguments.CLIOptions.MODULE.getId()) != null); |
57256 | 317 |
boolean hasAppImage = (bundlerArguments.get( |
56888
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
318 |
Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()) != null); |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
319 |
boolean hasClass = (bundlerArguments.get( |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
320 |
Arguments.CLIOptions.APPCLASS.getId()) != null); |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
321 |
boolean hasMain = (bundlerArguments.get( |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
322 |
Arguments.CLIOptions.MAIN_JAR.getId()) != null); |
57030
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
323 |
boolean hasRuntimeImage = (bundlerArguments.get( |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
324 |
Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId()) != null); |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
325 |
boolean hasInput = (bundlerArguments.get( |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
326 |
Arguments.CLIOptions.INPUT.getId()) != null); |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
327 |
boolean hasModulePath = (bundlerArguments.get( |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
328 |
Arguments.CLIOptions.MODULE_PATH.getId()) != null); |
57256 | 329 |
boolean runtimeInstaller = (BundlerType.INSTALLER == getBundleType()) && |
330 |
!hasAppImage && !hasModule && !hasMain && hasRuntimeImage; |
|
57030
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
331 |
|
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
332 |
if (getBundleType() == BundlerType.IMAGE) { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
333 |
// Module application requires --runtime-image or --module-path |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
334 |
if (hasModule) { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
335 |
if (!hasModulePath && !hasRuntimeImage) { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
336 |
throw new PackagerException("ERR_MissingArgument", |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
337 |
"--runtime-image or --module-path"); |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
338 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
339 |
} else { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
340 |
if (!hasInput) { |
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
341 |
throw new PackagerException( |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
342 |
"ERR_MissingArgument", "--input"); |
57030
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
343 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
344 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
345 |
} else if (getBundleType() == BundlerType.INSTALLER) { |
57150 | 346 |
if (!runtimeInstaller) { |
57030
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
347 |
if (hasModule) { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
348 |
if (!hasModulePath && !hasRuntimeImage && !hasAppImage) { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
349 |
throw new PackagerException("ERR_MissingArgument", |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
350 |
"--runtime-image, --module-path or --app-image"); |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
351 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
352 |
} else { |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
353 |
if (!hasInput && !hasAppImage) { |
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
354 |
throw new PackagerException("ERR_MissingArgument", |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
355 |
"--input or --app-image"); |
57030
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
356 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
357 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
358 |
} |
902f4c4fba42
8214021: Create additional automated tests for jpackager
herrick
parents:
57022
diff
changeset
|
359 |
} |
56888
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
360 |
|
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
361 |
// if bundling non-modular image, or installer without app-image |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
362 |
// then we need some resources and a main class |
57256 | 363 |
if (!hasModule && !hasAppImage && !runtimeInstaller) { |
56888
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
364 |
if (resources.isEmpty()) { |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
365 |
throw new PackagerException("ERR_MissingAppResources"); |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
366 |
} |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
367 |
if (!hasClass) { |
57150 | 368 |
throw new PackagerException("ERR_MissingArgument", |
369 |
"--main-class"); |
|
56888
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
370 |
} |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
371 |
if (!hasMain) { |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
372 |
throw new PackagerException("ERR_MissingArgument", |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
373 |
"--main-jar"); |
56888
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
374 |
} |
628a283daa6c
8210505: Unable to create an installer from an app-image on linux
herrick
parents:
56882
diff
changeset
|
375 |
} |
56902
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
376 |
|
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
377 |
String name = (String)bundlerArguments.get( |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
378 |
Arguments.CLIOptions.NAME.getId()); |
57119 | 379 |
validateName(name, true); |
56985 | 380 |
|
56902
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
381 |
// Validate app image if set |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
382 |
String appImage = (String)bundlerArguments.get( |
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
383 |
Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()); |
56902
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
384 |
if (appImage != null) { |
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
385 |
File appImageDir = new File(appImage); |
57218
8018ecf829bc
8217902: jpackage fails with --app-image option on mac
herrick
parents:
57150
diff
changeset
|
386 |
if (!appImageDir.exists() || appImageDir.list().length == 0) { |
56902
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
387 |
throw new PackagerException("ERR_AppImageNotExist", appImage); |
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
388 |
} |
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
389 |
} |
57080 | 390 |
|
57256 | 391 |
// Validate temp-root |
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
392 |
String root = (String)bundlerArguments.get( |
57256 | 393 |
Arguments.CLIOptions.TEMP_ROOT.getId()); |
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
394 |
if (root != null) { |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
395 |
String [] contents = (new File(root)).list(); |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
396 |
|
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
397 |
if (contents != null && contents.length > 0) { |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
398 |
throw new PackagerException("ERR_BuildRootInvalid", root); |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
399 |
} |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
400 |
} |
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
401 |
|
57080 | 402 |
// Validate license file if set |
403 |
String license = (String)bundlerArguments.get( |
|
404 |
Arguments.CLIOptions.LICENSE_FILE.getId()); |
|
405 |
if (license != null) { |
|
406 |
File licenseFile = new File(license); |
|
407 |
if (!licenseFile.exists()) { |
|
408 |
throw new PackagerException("ERR_LicenseFileNotExit"); |
|
409 |
} |
|
410 |
} |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
411 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
412 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
413 |
boolean validateForBundle() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
414 |
boolean result = false; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
415 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
416 |
// Success |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
417 |
if (((applicationClass != null && !applicationClass.isEmpty()) || |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
418 |
(module != null && !module.isEmpty()))) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
419 |
result = true; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
420 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
421 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
422 |
return result; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
423 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
424 |
|
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
425 |
BundlerType bundleType = BundlerType.NONE; |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
426 |
String targetFormat = null; //means any |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
427 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
428 |
void setBundleType(BundlerType type) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
429 |
bundleType = type; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
430 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
431 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
432 |
BundlerType getBundleType() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
433 |
return bundleType; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
434 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
435 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
436 |
void setTargetFormat(String t) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
437 |
targetFormat = t; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
438 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
439 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
440 |
String getTargetFormat() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
441 |
return targetFormat; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
442 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
443 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
444 |
private String getArch() { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
445 |
String arch = System.getProperty("os.arch").toLowerCase(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
446 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
447 |
if ("x86".equals(arch) || "i386".equals(arch) || "i486".equals(arch) |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
448 |
|| "i586".equals(arch) || "i686".equals(arch)) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
449 |
arch = "x86"; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
450 |
} else if ("x86_64".equals(arch) || "amd64".equals("arch")) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
451 |
arch = "x86_64"; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
452 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
453 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
454 |
return arch; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
455 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
456 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
457 |
static final Set<String> multi_args = new TreeSet<>(Arrays.asList( |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
458 |
StandardBundlerParam.JVM_OPTIONS.getID(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
459 |
StandardBundlerParam.ARGUMENTS.getID(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
460 |
StandardBundlerParam.MODULE_PATH.getID(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
461 |
StandardBundlerParam.ADD_MODULES.getID(), |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
462 |
StandardBundlerParam.LIMIT_MODULES.getID(), |
56982
e094d5483bd6
8212048: Cleanup source code and fix issues discussed in preliminary review
herrick
parents:
56933
diff
changeset
|
463 |
StandardBundlerParam.FILE_ASSOCIATIONS.getID() |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
464 |
)); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
465 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
466 |
@SuppressWarnings("unchecked") |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
467 |
public void addBundleArgument(String key, Object value) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
468 |
// special hack for multi-line arguments |
56836
40abf95122b0
8207143: jpackager fails to parse file associations
herrick
parents:
56821
diff
changeset
|
469 |
if (multi_args.contains(key)) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
470 |
Object existingValue = bundlerArguments.get(key); |
56836
40abf95122b0
8207143: jpackager fails to parse file associations
herrick
parents:
56821
diff
changeset
|
471 |
if (existingValue instanceof String && value instanceof String) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
472 |
bundlerArguments.put(key, existingValue + "\n\n" + value); |
56836
40abf95122b0
8207143: jpackager fails to parse file associations
herrick
parents:
56821
diff
changeset
|
473 |
} else if (existingValue instanceof List && value instanceof List) { |
40abf95122b0
8207143: jpackager fails to parse file associations
herrick
parents:
56821
diff
changeset
|
474 |
((List)existingValue).addAll((List)value); |
40abf95122b0
8207143: jpackager fails to parse file associations
herrick
parents:
56821
diff
changeset
|
475 |
} else if (existingValue instanceof Map && |
40abf95122b0
8207143: jpackager fails to parse file associations
herrick
parents:
56821
diff
changeset
|
476 |
value instanceof String && ((String)value).contains("=")) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
477 |
String[] mapValues = ((String)value).split("=", 2); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
478 |
((Map)existingValue).put(mapValues[0], mapValues[1]); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
479 |
} else { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
480 |
bundlerArguments.put(key, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
481 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
482 |
} else { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
483 |
bundlerArguments.put(key, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
484 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
485 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
486 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
487 |
BundleParams getBundleParams() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
488 |
BundleParams bundleParams = new BundleParams(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
489 |
|
57096
d06bec27f8c9
8215903: modify behavior of retaining temporary output dir
herrick
parents:
57080
diff
changeset
|
490 |
// construct app resources relative to output folder! |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
491 |
bundleParams.setAppResourcesList(resources); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
492 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
493 |
bundleParams.setIdentifier(id); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
494 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
495 |
bundleParams.setApplicationClass(applicationClass); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
496 |
bundleParams.setAppVersion(version); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
497 |
bundleParams.setType(bundleType); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
498 |
bundleParams.setBundleFormat(targetFormat); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
499 |
bundleParams.setVendor(vendor); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
500 |
bundleParams.setEmail(email); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
501 |
bundleParams.setInstalldirChooser(installdirChooser); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
502 |
bundleParams.setCopyright(copyright); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
503 |
bundleParams.setDescription(description); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
504 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
505 |
bundleParams.setJvmargs(jvmargs); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
506 |
bundleParams.setArguments(arguments); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
507 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
508 |
if (addModules != null && !addModules.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
509 |
bundleParams.setAddModules(addModules); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
510 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
511 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
512 |
if (limitModules != null && !limitModules.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
513 |
bundleParams.setLimitModules(limitModules); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
514 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
515 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
516 |
if (modulePath != null && !modulePath.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
517 |
bundleParams.setModulePath(modulePath); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
518 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
519 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
520 |
if (module != null && !module.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
521 |
bundleParams.setMainModule(module); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
522 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
523 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
524 |
if (debugPort != null && !debugPort.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
525 |
bundleParams.setDebug(debugPort); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
526 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
527 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
528 |
Map<String, String> paramsMap = new TreeMap<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
529 |
if (params != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
530 |
for (Param p : params) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
531 |
paramsMap.put(p.name, p.value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
532 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
533 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
534 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
535 |
Map<String, String> unescapedHtmlParams = new TreeMap<>(); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
536 |
Map<String, String> escapedHtmlParams = new TreeMap<>(); |
56902
6972c0e75e23
8210367: invalid --app-image arg causes exception runnning light.exe in windows
herrick
parents:
56888
diff
changeset
|
537 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
538 |
// check for collisions |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
539 |
TreeSet<String> keys = new TreeSet<>(bundlerArguments.keySet()); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
540 |
keys.retainAll(bundleParams.getBundleParamsAsMap().keySet()); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
541 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
542 |
if (!keys.isEmpty()) { |
56869
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
543 |
throw new RuntimeException("Deploy Params and Bundler Arguments " |
41e17fe9fbeb
8208522: removed unreferenced class and minor formatting of java source
herrick
parents:
56848
diff
changeset
|
544 |
+ "overlap in the following values:" + keys.toString()); |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
545 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
546 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
547 |
bundleParams.addAllBundleParams(bundlerArguments); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
548 |
|
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
549 |
return bundleParams; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
550 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
551 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
552 |
Map<String, ? super Object> getBundlerArguments() { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
553 |
return this.bundlerArguments; |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
554 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
555 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
556 |
void putUnlessNull(String param, Object value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
557 |
if (value != null) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
558 |
bundlerArguments.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
559 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
560 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
561 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
562 |
void putUnlessNullOrEmpty(String param, Map<?, ?> value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
563 |
if (value != null && !value.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
564 |
bundlerArguments.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
565 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
566 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
567 |
|
57067
9c17d779808e
8213425: Analyze output from Source code scanner and fix where needed.
herrick
parents:
57062
diff
changeset
|
568 |
void putUnlessNullOrEmpty(String param, Collection<?> value) { |
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
569 |
if (value != null && !value.isEmpty()) { |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
570 |
bundlerArguments.put(param, value); |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
571 |
} |
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
572 |
} |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
573 |
|
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
574 |
@Override |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
575 |
public String toString() { |
57097
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
576 |
return "DeployParams {" + "output: " + outdir |
6e5eb7855fe2
8215900: Without --files args, only jars in the top level of --input are added to class-path
herrick
parents:
57096
diff
changeset
|
577 |
+ " resources: {" + resources + "}}"; |
56994
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
578 |
} |
b4aca2dbe2b5
8212537: Create method and class description comments for main functionality
herrick
parents:
56987
diff
changeset
|
579 |
|
56821
565d54ca1f41
8206005: Move prototype jpackager from closed sandbox to open sandbox
herrick
parents:
diff
changeset
|
580 |
} |