8213163: --app-image arg does not work creating exe installers JDK-8200758-branch
authorherrick
Thu, 01 Nov 2018 08:52:50 -0400
branchJDK-8200758-branch
changeset 57013 0ece1b6f0958
parent 57012 200666876601
child 57014 d3a84ae11429
8213163: --app-image arg does not work creating exe installers Reviewed-by: almatvee
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler.properties
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler_ja.properties
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler_zh_CN.properties
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.iss
src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinAppBundler.java
src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler.properties	Wed Oct 31 19:05:56 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler.properties	Thu Nov 01 08:52:50 2018 -0400
@@ -55,3 +55,4 @@
 message.result-dir=Result application bundle\: {0}
 message.disable-bit-architecture-check=Disabled check for bit architecture mismatch.
 message.icon-not-ico=The specified icon "{0}" is not an ICO file and will not be used.  The default icon will be used in it's place.
+message.multiple-launchers=Multiple launchers found in predefined app-image.  {0} will be used as primary launcher.
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler_ja.properties	Wed Oct 31 19:05:56 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler_ja.properties	Thu Nov 01 08:52:50 2018 -0400
@@ -55,3 +55,4 @@
 message.result-dir=\u7D50\u679C\u306E\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30F3\u30C9\u30EB: {0}
 message.disable-bit-architecture-check=\u30D3\u30C3\u30C8\u30FB\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3\u306E\u4E0D\u4E00\u81F4\u30C1\u30A7\u30C3\u30AF\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002
 message.icon-not-ico=\u6307\u5B9A\u3057\u305F\u30A2\u30A4\u30B3\u30F3"{0}"\u306FICO\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u306A\u304F\u3001\u4F7F\u7528\u3055\u308C\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u304C\u305D\u306E\u4F4D\u7F6E\u306B\u4F7F\u7528\u3055\u308C\u307E\u3059\u3002
+message.multiple-launchers=Multiple launchers found in predefined app-image.  {0} will be used as primary launcher.
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler_zh_CN.properties	Wed Oct 31 19:05:56 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinAppBundler_zh_CN.properties	Thu Nov 01 08:52:50 2018 -0400
@@ -55,3 +55,4 @@
 message.result-dir=\u751F\u6210\u7684\u5E94\u7528\u7A0B\u5E8F\u5305: {0}
 message.disable-bit-architecture-check=\u5DF2\u7981\u7528\u4F4D\u4F53\u7CFB\u7ED3\u6784\u4E0D\u5339\u914D\u68C0\u67E5\u3002
 message.icon-not-ico=\u6307\u5B9A\u7684\u56FE\u6807 "{0}" \u4E0D\u662F ICO \u6587\u4EF6, \u4E0D\u4F1A\u4F7F\u7528\u3002\u5C06\u4F7F\u7528\u9ED8\u8BA4\u56FE\u6807\u4EE3\u66FF\u3002
+message.multiple-launchers=Multiple launchers found in predefined app-image.  {0} will be used as primary launcher.
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.iss	Wed Oct 31 19:05:56 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.iss	Thu Nov 01 08:52:50 2018 -0400
@@ -1,14 +1,14 @@
 ;This file will be executed next to the application bundle image
-;I.e. current directory will contain folder APPLICATION_NAME with application files
+;I.e. current directory will contain folder INSTALLER_NAME with application files
 [Setup]
 AppId={{PRODUCT_APP_IDENTIFIER}}
-AppName=APPLICATION_NAME
+AppName=INSTALLER_NAME
 AppVersion=APPLICATION_VERSION
-AppVerName=APPLICATION_NAME APPLICATION_VERSION
+AppVerName=INSTALLER_NAME APPLICATION_VERSION
 AppPublisher=APPLICATION_VENDOR
 AppComments=APPLICATION_COMMENTS
 AppCopyright=APPLICATION_COPYRIGHT
-DefaultDirName=APPLICATION_INSTALL_ROOT\APPLICATION_NAME
+DefaultDirName=APPLICATION_INSTALL_ROOT\INSTALLER_NAME
 DisableStartupPrompt=Yes
 DisableDirPage=DISABLE_DIR_PAGE
 DisableProgramGroupPage=Yes
@@ -24,11 +24,11 @@
 Compression=lzma
 SolidCompression=yes
 PrivilegesRequired=APPLICATION_INSTALL_PRIVILEGE
-SetupIconFile=APPLICATION_NAME\APPLICATION_NAME.ico
-UninstallDisplayIcon={app}\APPLICATION_NAME.ico
-UninstallDisplayName=APPLICATION_NAME
+SetupIconFile=INSTALLER_NAME\LAUNCHER_NAME.ico
+UninstallDisplayIcon={app}\LAUNCHER_NAME.ico
+UninstallDisplayName=INSTALLER_NAME
 WizardImageStretch=No
-WizardSmallImageFile=APPLICATION_NAME-setup-icon.bmp   
+WizardSmallImageFile=INSTALLER_NAME-setup-icon.bmp   
 ArchitecturesInstallIn64BitMode=ARCHITECTURE_BIT_MODE
 FILE_ASSOCIATIONS
 
@@ -36,21 +36,21 @@
 Name: "english"; MessagesFile: "compiler:Default.isl"
 
 [Files]
-Source: "APPLICATION_NAME\APPLICATION_NAME.exe"; DestDir: "{app}"; Flags: ignoreversion
-Source: "APPLICATION_NAME\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "INSTALLER_NAME\LAUNCHER_NAME.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "INSTALLER_NAME\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
 
 [Icons]
-Name: "{group}\APPLICATION_NAME"; Filename: "{app}\APPLICATION_NAME.exe"; IconFilename: "{app}\APPLICATION_NAME.ico"; Check: APPLICATION_MENU_SHORTCUT()
-Name: "{commondesktop}\APPLICATION_NAME"; Filename: "{app}\APPLICATION_NAME.exe";  IconFilename: "{app}\APPLICATION_NAME.ico"; Check: APPLICATION_DESKTOP_SHORTCUT()
+Name: "{group}\INSTALLER_NAME"; Filename: "{app}\LAUNCHER_NAME.exe"; IconFilename: "{app}\LAUNCHER_NAME.ico"; Check: APPLICATION_MENU_SHORTCUT()
+Name: "{commondesktop}\INSTALLER_NAME"; Filename: "{app}\LAUNCHER_NAME.exe";  IconFilename: "{app}\LAUNCHER_NAME.ico"; Check: APPLICATION_DESKTOP_SHORTCUT()
 SECONDARY_LAUNCHERS
 
 [Run]
 Filename: "{app}\RUN_FILENAME.exe"; Parameters: "-Xappcds:generatecache"; Check: APPLICATION_APP_CDS_INSTALL()
-Filename: "{app}\RUN_FILENAME.exe"; Description: "{cm:LaunchProgram,APPLICATION_NAME}"; Flags: nowait postinstall skipifsilent; Check: APPLICATION_NOT_SERVICE()
-Filename: "{app}\RUN_FILENAME.exe"; Parameters: "-install -svcName ""APPLICATION_NAME"" -svcDesc ""APPLICATION_DESCRIPTION"" -mainExe ""APPLICATION_LAUNCHER_FILENAME"" START_ON_INSTALL RUN_AT_STARTUP"; Check: APPLICATION_SERVICE()
+Filename: "{app}\RUN_FILENAME.exe"; Description: "{cm:LaunchProgram,INSTALLER_NAME}"; Flags: nowait postinstall skipifsilent; Check: APPLICATION_NOT_SERVICE()
+Filename: "{app}\RUN_FILENAME.exe"; Parameters: "-install -svcName ""INSTALLER_NAME"" -svcDesc ""APPLICATION_DESCRIPTION"" -mainExe ""APPLICATION_LAUNCHER_FILENAME"" START_ON_INSTALL RUN_AT_STARTUP"; Check: APPLICATION_SERVICE()
 
 [UninstallRun]
-Filename: "{app}\RUN_FILENAME.exe "; Parameters: "-uninstall -svcName APPLICATION_NAME STOP_ON_UNINSTALL"; Check: APPLICATION_SERVICE()
+Filename: "{app}\RUN_FILENAME.exe "; Parameters: "-uninstall -svcName INSTALLER_NAME STOP_ON_UNINSTALL"; Check: APPLICATION_SERVICE()
 
 [Code]
 function returnTrue(): Boolean;
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinAppBundler.java	Wed Oct 31 19:05:56 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinAppBundler.java	Thu Nov 01 08:52:50 2018 -0400
@@ -158,7 +158,7 @@
     }
 
     private static String appName;
-    private synchronized static String getAppName(
+    synchronized static String getAppName(
             Map<String, ? super Object> p) {
         // If we building from predefined app image, then we should use names
         // from image and not from CLI.
@@ -170,9 +170,9 @@
                         WIN_APP_IMAGE.fetchFrom(p).toString() + "\\app");
                 File [] files = appImageDir.listFiles(
                         (File dir, String name) -> name.endsWith(".cfg"));
-                if (files == null || files.length != 1) {
+                if (files == null || files.length == 0) {
                     throw new RuntimeException(MessageFormat.format(
-                        I18N.getString("error.cannot-find-cfg"),
+                        I18N.getString("error.cannot-find-launcher"),
                         appImageDir));
                 } else {
                     appName = files[0].getName();
@@ -180,8 +180,11 @@
                     if (index != -1) {
                         appName = appName.substring(0, index);
                     }
+                    if (files.length > 1) {
+                        Log.info(MessageFormat.format(I18N.getString(
+                                "message.multiple-launchers"), appName));
+                    }
                 }
-
                 return appName;
             } else {
                 return appName;
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java	Wed Oct 31 19:05:56 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java	Thu Nov 01 08:52:50 2018 -0400
@@ -559,13 +559,16 @@
         data.put("PRODUCT_APP_IDENTIFIER",
                 innosetupEscape(getAppIdentifier(p)));
 
-        validateValueAndPut(data, "APPLICATION_NAME", APP_NAME, p);
 
+        validateValueAndPut(data, "INSTALLER_NAME", APP_NAME, p);
         validateValueAndPut(data, "APPLICATION_VENDOR", VENDOR, p);
         validateValueAndPut(data, "APPLICATION_VERSION", VERSION, p);
         validateValueAndPut(data, "INSTALLER_FILE_NAME",
                 INSTALLER_FILE_NAME, p);
 
+        data.put("LAUNCHER_NAME",
+                innosetupEscape(WinAppBundler.getAppName(p)));
+
         data.put("APPLICATION_LAUNCHER_FILENAME",
                 innosetupEscape(WinAppBundler.getLauncherName(p)));