8219683: Modify App Image layout on Mac JDK-8200758-branch
authorherrick
Fri, 19 Apr 2019 14:16:13 -0400
branchJDK-8200758-branch
changeset 57333 77109ab87402
parent 57332 4649818834e0
child 57334 2e028c5fde1e
8219683: Modify App Image layout on Mac Reviewed-by: kbr
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java
src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm
test/jdk/tools/jpackage/helpers/JPackagePath.java
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Fri Apr 19 08:00:42 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java	Fri Apr 19 14:16:13 2019 -0400
@@ -166,7 +166,7 @@
     public MacAppImageBuilder(Map<String, Object> config, Path imageOutDir)
             throws IOException {
         super(config, imageOutDir.resolve(APP_NAME.fetchFrom(config)
-                + ".app/Contents/PlugIns/Java.runtime/Contents/Home"));
+                + ".app/Contents/runtime/Contents/Home"));
 
         Objects.requireNonNull(imageOutDir);
 
@@ -177,7 +177,7 @@
         this.javaModsDir = javaDir.resolve("mods");
         this.resourcesDir = contentsDir.resolve("Resources");
         this.macOSDir = contentsDir.resolve("MacOS");
-        this.runtimeDir = contentsDir.resolve("PlugIns/Java.runtime");
+        this.runtimeDir = contentsDir.resolve("runtime");
         this.runtimeRoot = runtimeDir.resolve("Contents/Home");
         this.mdir = runtimeRoot.resolve("lib");
         Files.createDirectories(javaDir);
@@ -317,7 +317,7 @@
         executable.toFile().setExecutable(true, false);
         // generate main app launcher config file
         File cfg = new File(root.toFile(), getLauncherCfgName(params));
-        writeCfgFile(params, cfg, "$APPDIR/PlugIns/Java.runtime");
+        writeCfgFile(params, cfg, "$APPDIR/runtime");
 
         // create additional app launcher(s) and config file(s)
         List<Map<String, ? super Object>> entryPoints =
@@ -335,7 +335,7 @@
 
             // add config file for add launcher
             cfg = new File(root.toFile(), getLauncherCfgName(tmp));
-            writeCfgFile(tmp, cfg, "$APPDIR/PlugIns/Java.runtime");
+            writeCfgFile(tmp, cfg, "$APPDIR/runtime");
         }
 
         // Copy class path entries to Java folder
@@ -502,7 +502,7 @@
                 COPYRIGHT.fetchFrom(params) != null ?
                 COPYRIGHT.fetchFrom(params) : "Unknown");
         data.put("DEPLOY_LAUNCHER_NAME", getLauncherName(params));
-        data.put("DEPLOY_JAVA_RUNTIME_NAME", "$APPDIR/PlugIns/Java.runtime");
+        data.put("DEPLOY_JAVA_RUNTIME_NAME", "$APPDIR/runtime");
         data.put("DEPLOY_BUNDLE_SHORT_VERSION",
                 VERSION.fetchFrom(params) != null ?
                 VERSION.fetchFrom(params) : "1.0.0");
@@ -874,7 +874,7 @@
             throw ioe;
         }
 
-        // sign all plugins and frameworks
+        // sign all runtime and frameworks
         Consumer<? super Path> signIdentifiedByPList = path -> {
             //noinspection ThrowableResultOfMethodCallIgnored
             if (toThrow.get() != null) return;
@@ -913,9 +913,9 @@
             }
         };
 
-        Path pluginsPath = appLocation.resolve("Contents/PlugIns");
-        if (Files.isDirectory(pluginsPath)) {
-            Files.list(pluginsPath)
+        Path javaPath = appLocation.resolve("Contents/runtime");
+        if (Files.isDirectory(javaPath)) {
+            Files.list(javaPath)
                     .forEach(signIdentifiedByPList);
 
             ioe = toThrow.get();
--- a/src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm	Fri Apr 19 08:00:42 2019 -0400
+++ b/src/jdk.jpackage/macosx/native/libapplauncher/MacPlatform.mm	Fri Apr 19 14:16:13 2019 -0400
@@ -107,7 +107,7 @@
 
 TString MacPlatform::GetPackageRuntimeBinDirectory() {
     return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory()) +
-            _T("Plugins/Java.runtime/Contents/Home/bin");
+            _T("runtime/Contents/Home/bin");
 }
 
 bool MacPlatform::UsePListForConfigFile() {
--- a/test/jdk/tools/jpackage/helpers/JPackagePath.java	Fri Apr 19 08:00:42 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/JPackagePath.java	Fri Apr 19 14:16:13 2019 -0400
@@ -152,15 +152,17 @@
     // Returns path including executable to java in image runtime folder
     public static String getRuntimeJava() {
         if (JPackageHelper.isWindows()) {
-            return "output" + File.separator + "test" + File.separator + "runtime" + File.separator
+            return "output" + File.separator + "test"
+                    + File.separator + "runtime" + File.separator
                     + "bin" + File.separator + "java.exe";
         } else if (JPackageHelper.isOSX()) {
             return "output" + File.separator + "test.app" + File.separator
-                    + "Contents" + File.separator + "PlugIns" + File.separator
-                    + "Java.runtime" + File.separator + "Contents" + File.separator
+                    + "Contents" + File.separator
+                    + "runtime" + File.separator + "Contents" + File.separator
                     + "Home" + File.separator + "bin" + File.separator + "java";
         } else if (JPackageHelper.isLinux()) {
-            return "output" + File.separator + "test" + File.separator + "runtime" + File.separator
+            return "output" + File.separator + "test"
+                    + File.separator + "runtime" + File.separator
                     + "bin" + File.separator + "java";
         } else {
             throw new AssertionError("Cannot detect platform");
@@ -175,16 +177,17 @@
     // Returns path to bin folder in image runtime
     public static String getRuntimeBin() {
         if (JPackageHelper.isWindows()) {
-            return "output" + File.separator + "test" + File.separator + "runtime"
-                    + File.separator + "bin";
+            return "output" + File.separator + "test"
+                    + File.separator + "runtime" + File.separator + "bin";
         } else if (JPackageHelper.isOSX()) {
-            return "output" + File.separator + "test.app" + File.separator + "Contents"
-                    + File.separator + "PlugIns" + File.separator + "Java.runtime"
-                    + File.separator + "Contents" + File.separator + "Home" + File.separator
-                    + "bin";
+            return "output" + File.separator + "test.app"
+                    + File.separator + "Contents"
+                    + File.separator + "runtime"
+                    + File.separator + "Contents"
+                    + File.separator + "Home" + File.separator + "bin";
         } else if (JPackageHelper.isLinux()) {
-            return "output" + File.separator + "test" + File.separator + "runtime"
-                    + File.separator + "bin";
+            return "output" + File.separator + "test"
+                    + File.separator + "runtime" + File.separator + "bin";
         } else {
             throw new AssertionError("Cannot detect platform");
         }