changeset 59681:9aba9109a25e

8236132: Add missing properties to msi installers Reviewed-by: herrick, almatvee
author asemenyuk
date Thu, 16 Jan 2020 08:28:21 -0500
parents 456475106ee0
children adcb848a9ecc
files src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java	Thu Jan 16 08:25:46 2020 -0500
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java	Thu Jan 16 08:28:21 2020 -0500
@@ -350,6 +350,21 @@
                     MSI_IMAGE_DIR.fetchFrom(params), true);
         }
 
+        // Configure installer icon
+        if (StandardBundlerParam.isRuntimeInstaller(params)) {
+            // Use icon from java launcher.
+            // Assume java.exe exists in Java Runtime being packed.
+            // Ignore custom icon if any as we don't want to copy anything in
+            // Java Runtime image.
+            installerIcon = ApplicationLayout.javaRuntime()
+                    .runtimeDirectory()
+                    .resolve(Path.of("bin", "java.exe"));
+        } else {
+            installerIcon = ApplicationLayout.windowsAppImage()
+                    .launchersDirectory()
+                    .resolve(APP_NAME.fetchFrom(params) + ".exe");
+        }
+
         params.put(WIN_APP_IMAGE.getID(), appDir);
 
         String licenseFile = LICENSE_FILE.fetchFrom(params);
@@ -420,6 +435,7 @@
         data.put("JpAppDescription", DESCRIPTION.fetchFrom(params));
         data.put("JpAppVendor", VENDOR.fetchFrom(params));
         data.put("JpAppVersion", PRODUCT_VERSION.fetchFrom(params));
+        data.put("JpIcon", installerIcon.toString());
 
         final Path configDir = CONFIG_ROOT.fetchFrom(params).toPath();
 
@@ -586,6 +602,7 @@
 
     }
 
+    private Path installerIcon;
     private Map<WixTool, WixTool.ToolInfo> wixToolset;
     private WixSourcesBuilder wixSourcesBuilder = new WixSourcesBuilder();
 
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs	Thu Jan 16 08:25:46 2020 -0500
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs	Thu Jan 16 08:28:21 2020 -0500
@@ -86,6 +86,11 @@
     <CustomAction Id="JpCheckInstallDir" BinaryKey="JpCaDll" DllEntry="CheckInstallDir" />
     <?endif?>
 
+    <CustomAction Id="JpSetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
+    <?ifdef JpIcon ?>
+    <CustomAction Id="JpSetARPPRODUCTICON" Property="ARPPRODUCTICON" Value="[INSTALLDIR]$(var.JpIcon)" />
+    <?endif?>
+
     <UI>
       <?ifdef JpInstallDirChooser ?>
       <Dialog Id="JpInvalidInstallDir" Width="300" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
@@ -133,5 +138,11 @@
     <WixVariable Id="WixUILicenseRtf" Value="$(var.JpLicenseRtf)"/>
     <?endif?>
 
+    <InstallExecuteSequence>
+      <Custom Action="JpSetARPINSTALLLOCATION" After="CostFinalize">Not Installed</Custom>
+      <?ifdef JpIcon ?>
+      <Custom Action="JpSetARPPRODUCTICON" After="JpSetARPINSTALLLOCATION">Not Installed</Custom>
+      <?endif?>
+    </InstallExecuteSequence>
   </Product>
 </Wix>