74 |
74 |
75 private final Path root; |
75 private final Path root; |
76 private final Path contentsDir; |
76 private final Path contentsDir; |
77 private final Path javaDir; |
77 private final Path javaDir; |
78 private final Path javaModsDir; |
78 private final Path javaModsDir; |
79 private final String relativeModsDir; |
|
80 private final Path resourcesDir; |
79 private final Path resourcesDir; |
81 private final Path macOSDir; |
80 private final Path macOSDir; |
82 private final Path runtimeDir; |
81 private final Path runtimeDir; |
83 private final Path runtimeRoot; |
82 private final Path runtimeRoot; |
84 private final Path mdir; |
83 private final Path mdir; |
174 this.params = config; |
173 this.params = config; |
175 this.root = imageOutDir.resolve(APP_NAME.fetchFrom(params) + ".app"); |
174 this.root = imageOutDir.resolve(APP_NAME.fetchFrom(params) + ".app"); |
176 this.contentsDir = root.resolve("Contents"); |
175 this.contentsDir = root.resolve("Contents"); |
177 this.javaDir = contentsDir.resolve("Java"); |
176 this.javaDir = contentsDir.resolve("Java"); |
178 this.javaModsDir = javaDir.resolve("mods"); |
177 this.javaModsDir = javaDir.resolve("mods"); |
179 this.relativeModsDir = "Java/mods"; |
|
180 this.resourcesDir = contentsDir.resolve("Resources"); |
178 this.resourcesDir = contentsDir.resolve("Resources"); |
181 this.macOSDir = contentsDir.resolve("MacOS"); |
179 this.macOSDir = contentsDir.resolve("MacOS"); |
182 this.runtimeDir = contentsDir.resolve("runtime"); |
180 this.runtimeDir = contentsDir.resolve("runtime"); |
183 this.runtimeRoot = runtimeDir.resolve("Contents/Home"); |
181 this.runtimeRoot = runtimeDir.resolve("Contents/Home"); |
184 this.mdir = runtimeRoot.resolve("lib"); |
182 this.mdir = runtimeRoot.resolve("lib"); |
197 this.params = config; |
195 this.params = config; |
198 this.root = imageOutDir.resolve(jreName ); |
196 this.root = imageOutDir.resolve(jreName ); |
199 this.contentsDir = root.resolve("Contents"); |
197 this.contentsDir = root.resolve("Contents"); |
200 this.javaDir = null; |
198 this.javaDir = null; |
201 this.javaModsDir = null; |
199 this.javaModsDir = null; |
202 this.relativeModsDir = null; |
|
203 this.resourcesDir = null; |
200 this.resourcesDir = null; |
204 this.macOSDir = null; |
201 this.macOSDir = null; |
205 this.runtimeDir = this.root; |
202 this.runtimeDir = this.root; |
206 this.runtimeRoot = runtimeDir.resolve("Contents/Home"); |
203 this.runtimeRoot = runtimeDir.resolve("Contents/Home"); |
207 this.mdir = runtimeRoot.resolve("lib"); |
204 this.mdir = runtimeRoot.resolve("lib"); |
276 public Path getAppModsDir() { |
273 public Path getAppModsDir() { |
277 return javaModsDir; |
274 return javaModsDir; |
278 } |
275 } |
279 |
276 |
280 @Override |
277 @Override |
281 public String getRelativeModsDir() { |
|
282 return relativeModsDir; |
|
283 } |
|
284 |
|
285 @Override |
|
286 public void prepareApplicationFiles() throws IOException { |
278 public void prepareApplicationFiles() throws IOException { |
287 Map<String, ? super Object> originalParams = new HashMap<>(params); |
279 Map<String, ? super Object> originalParams = new HashMap<>(params); |
288 // Generate PkgInfo |
280 // Generate PkgInfo |
289 File pkgInfoFile = new File(contentsDir.toFile(), "PkgInfo"); |
281 File pkgInfoFile = new File(contentsDir.toFile(), "PkgInfo"); |
290 pkgInfoFile.createNewFile(); |
282 pkgInfoFile.createNewFile(); |
301 writeEntry(is_lib, macOSDir.resolve(LIBRARY_NAME)); |
293 writeEntry(is_lib, macOSDir.resolve(LIBRARY_NAME)); |
302 } |
294 } |
303 executable.toFile().setExecutable(true, false); |
295 executable.toFile().setExecutable(true, false); |
304 // generate main app launcher config file |
296 // generate main app launcher config file |
305 File cfg = new File(root.toFile(), getLauncherCfgName(params)); |
297 File cfg = new File(root.toFile(), getLauncherCfgName(params)); |
306 writeCfgFile(params, cfg, "$APPDIR/runtime"); |
298 writeCfgFile(params, cfg); |
307 |
299 |
308 // create additional app launcher(s) and config file(s) |
300 // create additional app launcher(s) and config file(s) |
309 List<Map<String, ? super Object>> entryPoints = |
301 List<Map<String, ? super Object>> entryPoints = |
310 StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params); |
302 StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params); |
311 for (Map<String, ? super Object> entryPoint : entryPoints) { |
303 for (Map<String, ? super Object> entryPoint : entryPoints) { |
319 } |
311 } |
320 addExecutable.toFile().setExecutable(true, false); |
312 addExecutable.toFile().setExecutable(true, false); |
321 |
313 |
322 // add config file for add launcher |
314 // add config file for add launcher |
323 cfg = new File(root.toFile(), getLauncherCfgName(tmp)); |
315 cfg = new File(root.toFile(), getLauncherCfgName(tmp)); |
324 writeCfgFile(tmp, cfg, "$APPDIR/runtime"); |
316 writeCfgFile(tmp, cfg); |
325 } |
317 } |
326 |
318 |
327 // Copy class path entries to Java folder |
319 // Copy class path entries to Java folder |
328 copyClassPathEntries(javaDir); |
320 copyClassPathEntries(javaDir); |
329 |
321 |
487 getBundleName(params)); |
479 getBundleName(params)); |
488 data.put("DEPLOY_BUNDLE_COPYRIGHT", |
480 data.put("DEPLOY_BUNDLE_COPYRIGHT", |
489 COPYRIGHT.fetchFrom(params) != null ? |
481 COPYRIGHT.fetchFrom(params) != null ? |
490 COPYRIGHT.fetchFrom(params) : "Unknown"); |
482 COPYRIGHT.fetchFrom(params) : "Unknown"); |
491 data.put("DEPLOY_LAUNCHER_NAME", getLauncherName(params)); |
483 data.put("DEPLOY_LAUNCHER_NAME", getLauncherName(params)); |
492 data.put("DEPLOY_JAVA_RUNTIME_NAME", "$APPDIR/runtime"); |
484 data.put("DEPLOY_JAVA_RUNTIME_NAME", getCfgRuntimeDir()); |
493 data.put("DEPLOY_BUNDLE_SHORT_VERSION", |
485 data.put("DEPLOY_BUNDLE_SHORT_VERSION", |
494 VERSION.fetchFrom(params) != null ? |
486 VERSION.fetchFrom(params) != null ? |
495 VERSION.fetchFrom(params) : "1.0.0"); |
487 VERSION.fetchFrom(params) : "1.0.0"); |
496 data.put("DEPLOY_BUNDLE_CFBUNDLE_VERSION", |
488 data.put("DEPLOY_BUNDLE_CFBUNDLE_VERSION", |
497 MAC_CF_BUNDLE_VERSION.fetchFrom(params) != null ? |
489 MAC_CF_BUNDLE_VERSION.fetchFrom(params) != null ? |
537 |
529 |
538 newline = ""; |
530 newline = ""; |
539 |
531 |
540 data.put("DEPLOY_LAUNCHER_CLASS", MAIN_CLASS.fetchFrom(params)); |
532 data.put("DEPLOY_LAUNCHER_CLASS", MAIN_CLASS.fetchFrom(params)); |
541 |
533 |
542 StringBuilder macroedPath = new StringBuilder(); |
534 data.put("DEPLOY_APP_CLASSPATH", |
543 for (String s : CLASSPATH.fetchFrom(params).split("[ ;:]+")) { |
535 getCfgClassPath(CLASSPATH.fetchFrom(params))); |
544 macroedPath.append(s); |
|
545 macroedPath.append(":"); |
|
546 } |
|
547 macroedPath.deleteCharAt(macroedPath.length() - 1); |
|
548 |
|
549 data.put("DEPLOY_APP_CLASSPATH", macroedPath.toString()); |
|
550 |
536 |
551 StringBuilder bundleDocumentTypes = new StringBuilder(); |
537 StringBuilder bundleDocumentTypes = new StringBuilder(); |
552 StringBuilder exportedTypes = new StringBuilder(); |
538 StringBuilder exportedTypes = new StringBuilder(); |
553 for (Map<String, ? super Object> |
539 for (Map<String, ? super Object> |
554 fileAssociation : FILE_ASSOCIATIONS.fetchFrom(params)) { |
540 fileAssociation : FILE_ASSOCIATIONS.fetchFrom(params)) { |