changeset 7360:296d878c295d

RT-37599: Creation of a DMG from an APP is broken (scpt fails) Summary: Re-work script to depend on posix file name instead of finder presented name.
author shemnon
date Wed, 25 Jun 2014 14:25:12 -0600
parents 7312e6321ffa
children 85685c1fe33e
files modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacDmgBundler.java modules/fxpackager/src/main/resources/com/oracle/tools/packager/mac/DMGsetup.scpt
diffstat 2 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacDmgBundler.java	Wed Jun 25 11:10:31 2014 -0700
+++ b/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacDmgBundler.java	Wed Jun 25 14:25:12 2014 -0600
@@ -298,11 +298,13 @@
         protoDMG.getParentFile().mkdirs();
         finalDMG.getParentFile().mkdirs();
 
+        String hdiUtilVerbosityFlag = Log.isDebug() ? "-verbose" : "-quiet";
+
         //create temp image
         ProcessBuilder pb = new ProcessBuilder(
                 hdiutil,
                 "create",
-                "-quiet",
+                hdiUtilVerbosityFlag,
                 "-srcfolder", srcFolder.getAbsolutePath(),
                 "-volname", APP_NAME.fetchFrom(p),
                 "-ov", protoDMG.getAbsolutePath(),
@@ -314,7 +316,7 @@
                 hdiutil,
                 "attach",
                 protoDMG.getAbsolutePath(),
-                "-quiet",
+                hdiUtilVerbosityFlag,
                 "-mountroot", imagesRoot.getAbsolutePath());
         IOUtils.exec(pb, VERBOSE.fetchFrom(p));
 
@@ -364,7 +366,7 @@
         pb = new ProcessBuilder(
                 hdiutil,
                 "detach",
-                "-quiet",
+                hdiUtilVerbosityFlag,
                 mountedRoot.getAbsolutePath());
         IOUtils.exec(pb, VERBOSE.fetchFrom(p));
 
@@ -373,7 +375,7 @@
                 hdiutil,
                 "convert",
                 protoDMG.getAbsolutePath(),
-                "-quiet",
+                hdiUtilVerbosityFlag,
                 "-format", "UDZO",
                 "-o", finalDMG.getAbsolutePath());
         IOUtils.exec(pb, VERBOSE.fetchFrom(p));
--- a/modules/fxpackager/src/main/resources/com/oracle/tools/packager/mac/DMGsetup.scpt	Wed Jun 25 11:10:31 2014 -0700
+++ b/modules/fxpackager/src/main/resources/com/oracle/tools/packager/mac/DMGsetup.scpt	Wed Jun 25 14:25:12 2014 -0600
@@ -1,3 +1,4 @@
+delay 5
 tell application "Finder"
   tell disk "DEPLOY_ACTUAL_VOLUME_NAME"
     open
@@ -16,18 +17,21 @@
     -- Create alias for install location
     make new alias file at container window to DEPLOY_INSTALL_LOCATION with properties {name:"DEPLOY_INSTALL_NAME"}
 
-    -- First, move all files far enough to be not visible if user has "show hidden files" option set
-    -- Note: this only make sense if "hidden" files are also visible on the build system
-    --   otherwise command below will only return list of non-hidden items
-    set filesToHide to the name of every item of container window
-    repeat with theFile in filesToHide
-         set position of item theFile of container window to {1000, 0}
+    set allTheFiles to the name of every item of container window
+    repeat with theFile in allTheFiles
+      set theFilePath to POSIX Path of theFile
+      if theFilePath is "/DEPLOY_APPLICATION_NAME.app"
+        -- Position application location
+        set position of item theFile of container window to {120, 135}
+      else if theFilePath is "/DEPLOY_INSTALL_NAME"
+        -- Position install location
+        set position of item theFile of container window to {390, 135}
+      else
+        -- Move all other files far enough to be not visible if user has "show hidden files" option set
+        set position of item theFile of container window to {1000, 0}
+      end
     end repeat
 
-    -- Now position application and install location
-    set position of item "DEPLOY_APPLICATION_NAME" of container window to {120, 135}
-    set position of item "DEPLOY_INSTALL_NAME" of container window to {390, 135}
-
     close
     open
     update without registering applications