RFR: 8319457: Update jpackage to support WiX v4 and v5 on Windows
Alexey Semenyuk
asemenyuk at openjdk.org
Tue Apr 29 15:45:02 UTC 2025
On Sat, 26 Apr 2025 13:17:16 GMT, Oliver Kopp <duke at openjdk.org> wrote:
>>> jpackage allows override of main WiX source file (main.wxs), do you know what will happen if user will add main.wxs with format features available only in WiX 5 and will have WiX 5 toolkit installed?
>>
>> jpackage will detect the custom main.wxs is WiX4 format and pass it as is to `wix.exe`. I.e. custom WiX5 main.wxs will work with WiX5 toolkit.
>> However, it will fail if they try using custom main.wxs with WiX5-specific features with WiX4 toolkit. But this is out of the scope of jpackage.
>>
>>> Do you know if there any benefits to use any features available in WiX5 if WiX5 toolkit is installed, instead of using only WiX4 features with WiX5 toolkit?
>>
>> As far as I can tell from https://wixtoolset.org/docs/fivefour/, WiX5 reduces the redundancy of source files compared to WiX4. I can see how people handwriting sophisticated WiX source files can benefit from these improvements, not jpackage. The default main.wxs and two dialogs jpackage supplies are very basic and other sources are generated.
>
>> jpackage allows override of main WiX source file (main.wxs), do you know what will happen if user will add main.wxs with format features available only in WiX 5 and will have WiX 5 toolkit installed?
>
> @alexeysemenyukoracle Related question: Generation of `main.wxs` was moved from `prepareMainProjectFile` to `buildMSI`. This breaks [our patches to](https://github.com/JabRef/jabref/blob/95dcbe64659ced52627e012f2b6b5a60a9bb21b1/buildres/windows/JabRef-post-image.wsf#L18) `main.wxs` (which used to work for 6+ years now)
>
> Quoting https://docs.oracle.com/en/java/javase/24/jpackage/override-jpackage-resources.html#GUID-62412365-821D-4736-A20D-70F2D47136D8, the `post-image` script is executed before `buildMSI` (which is right).
>
>> Custom script that is **executed after the application image** is created and **before the MSI installer is built** for both .msi and .exe packages. No default script is provided.
>
> I would expect that all files are available before the "Post-image script" are available - and not generated **after** any **Post**-image script is run.
@koppor , ["JabRef post-image" script](https://github.com/JabRef/jabref/blob/95dcbe64659ced52627e012f2b6b5a60a9bb21b1/buildres/windows/JabRef-post-image.wsf#L18) has a couple of issues:
- A path to the "config" directory is derived from the current process directory. This logic is fragile and redundant. jpackage runs a copy of the "post-image" script from the "config" directory, so the path to the "config" directory is the parent folder of the script:
var installerConfig = fileSystem.GetFile(WScript.ScriptFullName).ParentFolder;
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19318#issuecomment-2839387341
More information about the core-libs-dev
mailing list