--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java Tue Feb 12 11:54:56 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java Tue Feb 12 11:58:41 2019 -0500
@@ -576,6 +576,7 @@
data.put("PRODUCT_GUID", productGUID.toString());
data.put("PRODUCT_UPGRADE_GUID",
UPGRADE_UUID.fetchFrom(params).toString());
+ data.put("UPGRADE_BLOCK", getUpgradeBlock(params));
data.put("APPLICATION_NAME", APP_NAME.fetchFrom(params));
data.put("APPLICATION_DESCRIPTION", DESCRIPTION.fetchFrom(params));
@@ -660,7 +661,6 @@
private int id;
private int compId;
private final static String LAUNCHER_ID = "LauncherId";
- private final static String LAUNCHER_SVC_ID = "LauncherSvcId";
/**
* Overrides the dialog sequence in built-in dialog set "WixUI_InstallDir"
@@ -676,6 +676,19 @@
+ " Order=\"2\"> 1"
+ " </Publish>\n";
+ // Required upgrade element for installers which support major upgrade (when user
+ // specifies --win-upgrade-uuid). We will allow downgrades.
+ private static final String UPGRADE_BLOCK =
+ "<MajorUpgrade AllowDowngrades=\"yes\"/>";
+
+ private String getUpgradeBlock(Map<String, ? super Object> params) {
+ if (UPGRADE_UUID.getIsDefaultValue()) {
+ return "";
+ } else {
+ return UPGRADE_BLOCK;
+ }
+ }
+
/**
* Creates UI element using WiX built-in dialog sets
* - WixUI_InstallDir/WixUI_Minimal.