JDK-8224788: jpackage fails on OS X when using --runtime-image JDK-8200758-branch
authorherrick
Thu, 08 Aug 2019 17:21:32 -0400
branchJDK-8200758-branch
changeset 57687 c56bbf4aaf98
parent 57591 6805e0ef7453
child 57688 7ea8c623393c
JDK-8224788: jpackage fails on OS X when using --runtime-image Reviewed-by: asemenyuk
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Tue Jul 30 09:58:18 2019 +0300
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Thu Aug 08 17:21:32 2019 -0400
@@ -355,6 +355,12 @@
         sign();
     }
 
+    @Override
+    File getRuntimeImageDir(File runtimeImageTop) {
+        File home = new File(runtimeImageTop, "Contents/Home");
+        return (home.exists() ? home : runtimeImageTop);
+    }
+
     private void copyRuntimeFiles() throws IOException {
         // Generate Info.plist
         writeInfoPlist(contentsDir.resolve("Info.plist").toFile());
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java	Tue Jul 30 09:58:18 2019 +0300
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java	Thu Aug 08 17:21:32 2019 -0400
@@ -241,6 +241,10 @@
         }
     }
 
+    File getRuntimeImageDir(File runtimeImageTop) {
+        return runtimeImageTop;
+    }
+
     String getCfgAppDir() {
         return "$APPDIR" + File.separator
                 + getAppDir().getFileName() + File.separator;
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java	Tue Jul 30 09:58:18 2019 +0300
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java	Thu Aug 08 17:21:32 2019 -0400
@@ -503,17 +503,18 @@
             Map<String, ? super Object> params,
             AbstractAppImageBuilder appBuilder)
             throws IOException , ConfigException {
-        File image = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params);
-        if (!image.exists()) {
+        File topImage = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params);
+        if (!topImage.exists()) {
             throw new ConfigException(
                     MessageFormat.format(I18N.getString(
                     "message.runtime-image-dir-does-not-exist"),
                     PREDEFINED_RUNTIME_IMAGE.getID(),
-                    image.toString()),
+                    topImage.toString()),
                     MessageFormat.format(I18N.getString(
                     "message.runtime-image-dir-does-not-exist.advice"),
                     PREDEFINED_RUNTIME_IMAGE.getID()));
         }
+        File image = appBuilder.getRuntimeImageDir(topImage);
         // copy whole runtime, need to skip jmods and src.zip
         final List<String> excludes = Arrays.asList("jmods", "src.zip");
         IOUtils.copyRecursive(image.toPath(), appBuilder.getRoot(), excludes);