86 |
86 |
87 private static List<String> keyChains; |
87 private static List<String> keyChains; |
88 |
88 |
89 public static final BundlerParamInfo<Boolean> |
89 public static final BundlerParamInfo<Boolean> |
90 MAC_CONFIGURE_LAUNCHER_IN_PLIST = new StandardBundlerParam<>( |
90 MAC_CONFIGURE_LAUNCHER_IN_PLIST = new StandardBundlerParam<>( |
91 I18N.getString("param.configure-launcher-in-plist"), |
|
92 I18N.getString( |
|
93 "param.configure-launcher-in-plist.description"), |
|
94 "mac.configure-launcher-in-plist", |
91 "mac.configure-launcher-in-plist", |
95 Boolean.class, |
92 Boolean.class, |
96 params -> Boolean.FALSE, |
93 params -> Boolean.FALSE, |
97 (s, p) -> Boolean.valueOf(s)); |
94 (s, p) -> Boolean.valueOf(s)); |
98 |
95 |
99 public static final BundlerParamInfo<String> MAC_CATEGORY = |
96 public static final EnumeratedBundlerParam<String> MAC_CATEGORY = |
100 new StandardBundlerParam<>( |
97 new EnumeratedBundlerParam<>( |
101 I18N.getString("param.category-name"), |
98 Arguments.CLIOptions.MAC_APP_STORE_CATEGORY.getId(), |
102 I18N.getString("param.category-name.description"), |
|
103 "mac.category", |
|
104 String.class, |
99 String.class, |
105 CATEGORY::fetchFrom, |
100 params -> "Unknown", |
106 (s, p) -> s |
101 (s, p) -> s, |
|
102 MacAppBundler.getMacCategories(), |
|
103 false //strict - for MacStoreBundler this should be strict |
107 ); |
104 ); |
108 |
105 |
109 public static final BundlerParamInfo<String> MAC_CF_BUNDLE_NAME = |
106 public static final BundlerParamInfo<String> MAC_CF_BUNDLE_NAME = |
110 new StandardBundlerParam<>( |
107 new StandardBundlerParam<>( |
111 I18N.getString("param.cfbundle-name.name"), |
|
112 I18N.getString("param.cfbundle-name.description"), |
|
113 "mac.CFBundleName", |
108 "mac.CFBundleName", |
114 String.class, |
109 String.class, |
115 params -> null, |
110 params -> null, |
116 (s, p) -> s); |
111 (s, p) -> s); |
117 |
112 |
118 public static final BundlerParamInfo<String> MAC_CF_BUNDLE_IDENTIFIER = |
113 public static final BundlerParamInfo<String> MAC_CF_BUNDLE_IDENTIFIER = |
119 new StandardBundlerParam<>( |
114 new StandardBundlerParam<>( |
120 I18N.getString("param.cfbundle-identifier.name"), |
|
121 I18N.getString("param.cfbundle-identifier.description"), |
|
122 Arguments.CLIOptions.MAC_BUNDLE_IDENTIFIER.getId(), |
115 Arguments.CLIOptions.MAC_BUNDLE_IDENTIFIER.getId(), |
123 String.class, |
116 String.class, |
124 IDENTIFIER::fetchFrom, |
117 IDENTIFIER::fetchFrom, |
125 (s, p) -> s); |
118 (s, p) -> s); |
126 |
119 |
127 public static final BundlerParamInfo<String> MAC_CF_BUNDLE_VERSION = |
120 public static final BundlerParamInfo<String> MAC_CF_BUNDLE_VERSION = |
128 new StandardBundlerParam<>( |
121 new StandardBundlerParam<>( |
129 I18N.getString("param.cfbundle-version.name"), |
|
130 I18N.getString("param.cfbundle-version.description"), |
|
131 "mac.CFBundleVersion", |
122 "mac.CFBundleVersion", |
132 String.class, |
123 String.class, |
133 p -> { |
124 p -> { |
134 String s = VERSION.fetchFrom(p); |
125 String s = VERSION.fetchFrom(p); |
135 if (validCFBundleVersion(s)) { |
126 if (validCFBundleVersion(s)) { |
140 }, |
131 }, |
141 (s, p) -> s); |
132 (s, p) -> s); |
142 |
133 |
143 public static final BundlerParamInfo<String> DEFAULT_ICNS_ICON = |
134 public static final BundlerParamInfo<String> DEFAULT_ICNS_ICON = |
144 new StandardBundlerParam<>( |
135 new StandardBundlerParam<>( |
145 I18N.getString("param.default-icon-icns"), |
|
146 I18N.getString("param.default-icon-icns.description"), |
|
147 ".mac.default.icns", |
136 ".mac.default.icns", |
148 String.class, |
137 String.class, |
149 params -> TEMPLATE_BUNDLE_ICON, |
138 params -> TEMPLATE_BUNDLE_ICON, |
150 (s, p) -> s); |
139 (s, p) -> s); |
151 |
140 |
152 public static final BundlerParamInfo<File> ICON_ICNS = |
141 public static final BundlerParamInfo<File> ICON_ICNS = |
153 new StandardBundlerParam<>( |
142 new StandardBundlerParam<>( |
154 I18N.getString("param.icon-icns.name"), |
|
155 I18N.getString("param.icon-icns.description"), |
|
156 "icon.icns", |
143 "icon.icns", |
157 File.class, |
144 File.class, |
158 params -> { |
145 params -> { |
159 File f = ICON.fetchFrom(params); |
146 File f = ICON.fetchFrom(params); |
160 if (f != null && !f.getName().toLowerCase().endsWith(".icns")) { |
147 if (f != null && !f.getName().toLowerCase().endsWith(".icns")) { |
166 }, |
153 }, |
167 (s, p) -> new File(s)); |
154 (s, p) -> new File(s)); |
168 |
155 |
169 public static final StandardBundlerParam<Boolean> SIGN_BUNDLE = |
156 public static final StandardBundlerParam<Boolean> SIGN_BUNDLE = |
170 new StandardBundlerParam<>( |
157 new StandardBundlerParam<>( |
171 I18N.getString("param.sign-bundle.name"), |
|
172 I18N.getString("param.sign-bundle.description"), |
|
173 Arguments.CLIOptions.MAC_SIGN.getId(), |
158 Arguments.CLIOptions.MAC_SIGN.getId(), |
174 Boolean.class, |
159 Boolean.class, |
175 params -> false, |
160 params -> false, |
176 // valueOf(null) is false, we actually do want null in some cases |
161 // valueOf(null) is false, we actually do want null in some cases |
177 (s, p) -> (s == null || "null".equalsIgnoreCase(s)) ? |
162 (s, p) -> (s == null || "null".equalsIgnoreCase(s)) ? |
332 executable.toFile().setExecutable(true, false); |
317 executable.toFile().setExecutable(true, false); |
333 // generate main app launcher config file |
318 // generate main app launcher config file |
334 File cfg = new File(root.toFile(), getLauncherCfgName(params)); |
319 File cfg = new File(root.toFile(), getLauncherCfgName(params)); |
335 writeCfgFile(params, cfg, "$APPDIR/PlugIns/Java.runtime"); |
320 writeCfgFile(params, cfg, "$APPDIR/PlugIns/Java.runtime"); |
336 |
321 |
337 // create secondary app launcher(s) and config file(s) |
322 // create additional app launcher(s) and config file(s) |
338 List<Map<String, ? super Object>> entryPoints = |
323 List<Map<String, ? super Object>> entryPoints = |
339 StandardBundlerParam.SECONDARY_LAUNCHERS.fetchFrom(params); |
324 StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params); |
340 for (Map<String, ? super Object> entryPoint : entryPoints) { |
325 for (Map<String, ? super Object> entryPoint : entryPoints) { |
341 Map<String, ? super Object> tmp = new HashMap<>(originalParams); |
326 Map<String, ? super Object> tmp = new HashMap<>(originalParams); |
342 tmp.putAll(entryPoint); |
327 tmp.putAll(entryPoint); |
343 |
328 |
344 // add executable for secondary launcher |
329 // add executable for add launcher |
345 Path secondaryExecutable = macOSDir.resolve(getLauncherName(tmp)); |
330 Path addExecutable = macOSDir.resolve(getLauncherName(tmp)); |
346 try (InputStream is = getResourceAsStream("jpackageapplauncher");) { |
331 try (InputStream is = getResourceAsStream("jpackageapplauncher");) { |
347 writeEntry(is, secondaryExecutable); |
332 writeEntry(is, addExecutable); |
348 } |
333 } |
349 secondaryExecutable.toFile().setExecutable(true, false); |
334 addExecutable.toFile().setExecutable(true, false); |
350 |
335 |
351 // add config file for secondary launcher |
336 // add config file for add launcher |
352 cfg = new File(root.toFile(), getLauncherCfgName(tmp)); |
337 cfg = new File(root.toFile(), getLauncherCfgName(tmp)); |
353 writeCfgFile(tmp, cfg, "$APPDIR/PlugIns/Java.runtime"); |
338 writeCfgFile(tmp, cfg, "$APPDIR/PlugIns/Java.runtime"); |
354 } |
339 } |
355 |
340 |
356 // Copy class path entries to Java folder |
341 // Copy class path entries to Java folder |
479 } |
464 } |
480 } |
465 } |
481 |
466 |
482 private void writeRuntimeInfoPlist(File file) throws IOException { |
467 private void writeRuntimeInfoPlist(File file) throws IOException { |
483 Map<String, String> data = new HashMap<>(); |
468 Map<String, String> data = new HashMap<>(); |
484 String identifier = RUNTIME_INSTALLER.fetchFrom(params) ? |
469 String identifier = StandardBundlerParam.isRuntimeInstaller(params) ? |
485 MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params) : |
470 MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params) : |
486 "com.oracle.java." + MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params); |
471 "com.oracle.java." + MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params); |
487 data.put("CF_BUNDLE_IDENTIFIER", identifier); |
472 data.put("CF_BUNDLE_IDENTIFIER", identifier); |
488 String name = RUNTIME_INSTALLER.fetchFrom(params) ? |
473 String name = StandardBundlerParam.isRuntimeInstaller(params) ? |
489 getBundleName(params): "Java Runtime Image"; |
474 getBundleName(params): "Java Runtime Image"; |
490 data.put("CF_BUNDLE_NAME", name); |
475 data.put("CF_BUNDLE_NAME", name); |
491 data.put("CF_BUNDLE_VERSION", VERSION.fetchFrom(params)); |
476 data.put("CF_BUNDLE_VERSION", VERSION.fetchFrom(params)); |
492 data.put("CF_BUNDLE_SHORT_VERSION_STRING", VERSION.fetchFrom(params)); |
477 data.put("CF_BUNDLE_SHORT_VERSION_STRING", VERSION.fetchFrom(params)); |
493 |
478 |