JDK-8211857: Support "exe" format for create-jre-installers JDK-8200758-branch
authorherrick
Tue, 09 Oct 2018 17:50:26 -0400
branchJDK-8200758-branch
changeset 56947 5a03c4524b90
parent 56946 f020e1a82d09
child 56948 60e53f98dac0
JDK-8211857: Support "exe" format for create-jre-installers Reviewed-by: almatvee, kcr
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinExeBundler.properties
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.iss
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.wxs
src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.server.jre.wxs
src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java
src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinMsiBundler.java
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinExeBundler.properties	Tue Oct 09 09:03:24 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/WinExeBundler.properties	Tue Oct 09 17:50:26 2018 -0400
@@ -85,3 +85,4 @@
 message.config-save-location=Config files are saved to {0}. Use them to customize package.
 message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut.
 message.creating-association-with-null-extension=Creating association with null extension.
+message.truncating.id=Truncating Application ID to 126 chars for Inno Setup.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.iss	Tue Oct 09 17:50:26 2018 -0400
@@ -0,0 +1,58 @@
+;This file will be executed next to the application bundle image
+;I.e. current directory will contain folder APPLICATION_NAME with application files
+[Setup]
+AppId={{PRODUCT_APP_IDENTIFIER}}
+AppName=APPLICATION_NAME
+AppVersion=APPLICATION_VERSION
+AppVerName=APPLICATION_NAME APPLICATION_VERSION
+AppPublisher=APPLICATION_VENDOR
+AppComments=APPLICATION_COMMENTS
+AppCopyright=APPLICATION_COPYRIGHT
+;AppPublisherURL=http://java.com/
+;AppSupportURL=http://java.com/
+;AppUpdatesURL=http://java.com/
+DefaultDirName=APPLICATION_INSTALL_ROOT\APPLICATION_NAME
+DisableStartupPrompt=Yes
+DisableDirPage=DISABLE_DIR_PAGE
+DisableProgramGroupPage=Yes
+DisableReadyPage=Yes
+DisableFinishedPage=Yes
+DisableWelcomePage=Yes
+DefaultGroupName=APPLICATION_GROUP
+;Optional License
+LicenseFile=APPLICATION_LICENSE_FILE
+;WinXP or above
+MinVersion=0,5.1 
+OutputBaseFilename=INSTALLER_FILE_NAME
+Compression=lzma
+SolidCompression=yes
+PrivilegesRequired=APPLICATION_INSTALL_PRIVILEGE
+SetupIconFile=
+UninstallDisplayIcon=
+UninstallDisplayName=APPLICATION_NAME
+WizardImageStretch=No
+WizardSmallImageFile=APPLICATION_NAME-setup-icon.bmp   
+ArchitecturesInstallIn64BitMode=ARCHITECTURE_BIT_MODE
+FILE_ASSOCIATIONS
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Files]
+Source: "APPLICATION_NAME\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+
+[Code]
+function returnTrue(): Boolean;
+begin
+  Result := True;
+end;
+
+function returnFalse(): Boolean;
+begin
+  Result := False;
+end;
+
+function InitializeSetup(): Boolean;
+begin
+  Result := True;
+end;  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.jre.wxs	Tue Oct 09 17:50:26 2018 -0400
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+    <Product Id="PRODUCT_GUID" Name="APPLICATION_NAME" 
+             Language="1033" Version="APPLICATION_VERSION"
+             Manufacturer="APPLICATION_VENDOR" 
+             UpgradeCode="PRODUCT_UPGRADE_GUID">
+        <Package Description="APPLICATION_DESCRIPTION" Comments="None"
+                 InstallerVersion="200" Compressed="yes"
+                 InstallScope="INSTALL_SCOPE" Platform="PLATFORM"/>
+        <Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
+
+        <!-- We use RemoveFolderEx to ensure application folder is fully 
+             removed on uninstall. Including files created outside of MSI
+             after application had been installed (e.g. on AU or user state).
+             
+             Hovewer, RemoveFolderEx is only available in WiX 3.6, 
+             we will comment it out if we running older WiX.
+
+             RemoveFolderEx requires that we "remember" the path for uninstall.
+             Read the path value and set the APPLICATIONFOLDER property with the value.
+        -->
+        <Property Id="APPLICATIONFOLDER">
+            <RegistrySearch Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME" 
+                            Root="REGISTRY_ROOT" Type="raw" 
+                            Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
+        </Property>
+        <DirectoryRef Id="APPLICATIONFOLDER">
+            <Component Id="CleanupMainApplicationFolder" Guid="*" Win64="WIN64">
+                <RegistryValue Root="REGISTRY_ROOT"
+                                   Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME"
+                                   Name="Path" Type="string" Value="[APPLICATIONFOLDER]"
+                                   KeyPath="yes" />
+                <!-- We need to use APPLICATIONFOLDER variable here or RemoveFolderEx
+                     will not remove on "install". But only if WiX 3.6 is used. -->
+                WIX36_ONLY_START     
+                  <util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
+                WIX36_ONLY_END
+            </Component>
+        </DirectoryRef>        
+        <?include bundle.wxi ?>
+UI_BLOCK
+    </Product>
+</Wix>
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/resources/windows/template.server.jre.wxs	Tue Oct 09 09:03:24 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
-     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-    <Product Id="PRODUCT_GUID" Name="APPLICATION_NAME" 
-             Language="1033" Version="APPLICATION_VERSION"
-             Manufacturer="APPLICATION_VENDOR" 
-             UpgradeCode="PRODUCT_UPGRADE_GUID">
-        <Package Description="APPLICATION_DESCRIPTION" Comments="None"
-                 InstallerVersion="200" Compressed="yes"
-                 InstallScope="INSTALL_SCOPE" Platform="PLATFORM"/>
-        <Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
-
-        <!-- We use RemoveFolderEx to ensure application folder is fully 
-             removed on uninstall. Including files created outside of MSI
-             after application had been installed (e.g. on AU or user state).
-             
-             Hovewer, RemoveFolderEx is only available in WiX 3.6, 
-             we will comment it out if we running older WiX.
-
-             RemoveFolderEx requires that we "remember" the path for uninstall.
-             Read the path value and set the APPLICATIONFOLDER property with the value.
-        -->
-        <Property Id="APPLICATIONFOLDER">
-            <RegistrySearch Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME" 
-                            Root="REGISTRY_ROOT" Type="raw" 
-                            Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
-        </Property>
-        <DirectoryRef Id="APPLICATIONFOLDER">
-            <Component Id="CleanupMainApplicationFolder" Guid="*" Win64="WIN64">
-                <RegistryValue Root="REGISTRY_ROOT"
-                                   Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME"
-                                   Name="Path" Type="string" Value="[APPLICATIONFOLDER]"
-                                   KeyPath="yes" />
-                <!-- We need to use APPLICATIONFOLDER variable here or RemoveFolderEx
-                     will not remove on "install". But only if WiX 3.6 is used. -->
-                WIX36_ONLY_START     
-                  <util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
-                WIX36_ONLY_END
-            </Component>
-        </DirectoryRef>        
-        <?include bundle.wxi ?>
-UI_BLOCK
-    </Product>
-</Wix>
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java	Tue Oct 09 09:03:24 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinExeBundler.java	Tue Oct 09 17:50:26 2018 -0400
@@ -136,6 +136,7 @@
 
 
     private final static String DEFAULT_EXE_PROJECT_TEMPLATE = "template.iss";
+    private final static String DEFAULT_JRE_EXE_TEMPLATE = "template.jre.iss";
     private static final String TOOL_INNO_SETUP_COMPILER = "iscc.exe";
 
     public static final BundlerParamInfo<String>
@@ -514,14 +515,15 @@
             return null;
         } finally {
             try {
-                if (VERBOSE.fetchFrom(p)) {
-                    saveConfigFiles(p);
-                }
-                if (imageDir != null && !Log.isDebug()) {
+                if (imageDir != null &&
+                        PREDEFINED_APP_IMAGE.fetchFrom(p) == null &&
+                        (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ||
+                        !Arguments.CREATE_JRE_INSTALLER.fetchFrom(p)) &&
+                        !Log.isDebug()) {
                     IOUtils.deleteRecursive(imageDir);
                 } else if (imageDir != null) {
                     Log.info(MessageFormat.format(
-                            getString("message.debug-working-directory"),
+                            I18N.getString("message.debug-working-directory"),
                             imageDir.getAbsolutePath()));
                 }
             } catch (IOException ex) {
@@ -567,9 +569,15 @@
     private String getAppIdentifier(Map<String, ? super Object> p) {
         String nm = IDENTIFIER.fetchFrom(p);
 
-        //limitation of innosetup
-        if (nm.length() > 126)
+        if (nm == null) {
+            nm = APP_NAME.fetchFrom(p);
+        }
+
+        // limitation of innosetup
+        if (nm.length() > 126) {
+            Log.info(getString("message-truncating-id"));
             nm = nm.substring(0, 126);
+        }
 
         return nm;
     }
@@ -623,8 +631,7 @@
         data.put("APPLICATION_MENU_SHORTCUT",
                 MENU_HINT.fetchFrom(p) ? "returnTrue" : "returnFalse");
         validateValueAndPut(data, "APPLICATION_GROUP", MENU_GROUP, p);
-        validateValueAndPut(data, "APPLICATION_COMMENTS",
-                TITLE, p); // TODO this seems strange, at least in name
+        validateValueAndPut(data, "APPLICATION_COMMENTS", TITLE, p);
         validateValueAndPut(data, "APPLICATION_COPYRIGHT", COPYRIGHT, p);
 
         data.put("APPLICATION_LICENSE_FILE",
@@ -865,7 +872,7 @@
 
         // TODO - alternate template for JRE installer
         String iss = Arguments.CREATE_JRE_INSTALLER.fetchFrom(p) ?
-                DEFAULT_EXE_PROJECT_TEMPLATE : DEFAULT_EXE_PROJECT_TEMPLATE;
+                DEFAULT_JRE_EXE_TEMPLATE : DEFAULT_EXE_PROJECT_TEMPLATE;
 
         Writer w = new BufferedWriter(new FileWriter(
                 getConfig_ExeProjectFile(p)));
--- a/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinMsiBundler.java	Tue Oct 09 09:03:24 2018 -0400
+++ b/src/jdk.packager/windows/classes/jdk/packager/internal/windows/WinMsiBundler.java	Tue Oct 09 17:50:26 2018 -0400
@@ -1139,7 +1139,7 @@
     }
     private final static String MSI_PROJECT_TEMPLATE = "template.wxs";
     private final static String MSI_PROJECT_TEMPLATE_SERVER_JRE =
-            "template.server.jre.wxs";
+            "template.jre.wxs";
     private final static String MSI_PROJECT_CONTENT_FILE = "bundle.wxi";
 
     private File buildMSI(Map<String, ? super Object> params, File outdir)