-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8319457: Update jpackage to support WiX v4 and v5 on Windows #19318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8319457: Update jpackage to support WiX v4 and v5 on Windows #19318
Conversation
…errides.wxi, and l10n .wxl files
… of two BiInteger objects and it didn't work right. When the bug was fixed app version check on Windows platform stopped working. It required a bit of work to get it working right.
…ED" to test desc. It fixes the following error: [22:09:20.347] TRACE: assertFalse(): Check [C:\Program Files\UpdateServiceTest\foo.ico] path doesn't exist [22:09:20.375] [ FAILED ] ServiceTest.testUpdate; checks=60 java.lang.ExceptionInInitializerError at jdk.jpackage.test.LauncherIconVerifier.applyTo(LauncherIconVerifier.java:70) at jdk.jpackage.test.AdditionalLauncher.verifyIcon(AdditionalLauncher.java:298) at jdk.jpackage.test.AdditionalLauncher.verify(AdditionalLauncher.java:363) at jdk.jpackage.test.LauncherAsServiceVerifier$1.verify(LauncherAsServiceVerifier.java:261) at jdk.jpackage.test.Functional$ThrowingConsumer.lambda$toConsumer$0(Functional.java:41) at jdk.jpackage.test.PackageTest$Handler.lambda$verifyPackageInstalled$6(PackageTest.java:660) at java.base/java.util.ArrayList.forEach(ArrayList.java:1597) at jdk.jpackage.test.PackageTest$Handler.verifyPackageInstalled(PackageTest.java:660) at jdk.jpackage.test.PackageTest$Handler.accept(PackageTest.java:594) at jdk.jpackage.test.PackageTest$2.accept(PackageTest.java:504) at jdk.jpackage.test.PackageTest$2.accept(PackageTest.java:411) at jdk.jpackage.test.Functional$ThrowingConsumer.lambda$toConsumer$0(Functional.java:41) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at jdk.jpackage.test.PackageTest$Group.lambda$runAction$0(PackageTest.java:364) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at jdk.jpackage.test.PackageTest$Group.runAction(PackageTest.java:364) at java.base/java.util.ArrayList.forEach(ArrayList.java:1597) at jdk.jpackage.test.RunnablePackageTest.runActions(RunnablePackageTest.java:66) at jdk.jpackage.test.RunnablePackageTest.run(RunnablePackageTest.java:58) at ServiceTest.testUpdate(ServiceTest.java:132) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at jdk.jpackage.test.MethodCall.accept(MethodCall.java:145) at jdk.jpackage.test.TestInstance.run(TestInstance.java:230) at jdk.jpackage.test.TKit.lambda$ignoreExceptions$5(TKit.java:141) at jdk.jpackage.test.TKit.lambda$runTests$3(TKit.java:126) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:807) at jdk.jpackage.test.TKit.lambda$runTests$4(TKit.java:123) at jdk.jpackage.test.Functional$ThrowingRunnable.lambda$toRunnable$0(Functional.java:105) at jdk.jpackage.test.TKit.withExtraLogStream(TKit.java:105) at jdk.jpackage.test.TKit.runTests(TKit.java:122) at jdk.jpackage.test.Main.runTests(Main.java:79) at jdk.jpackage.test.Main.lambda$main$2(Main.java:75) at jdk.jpackage.test.Functional$ThrowingRunnable.lambda$toRunnable$0(Functional.java:105) at jdk.jpackage.test.TKit.withExtraLogStream(TKit.java:109) at jdk.jpackage.test.Main.main(Main.java:75) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138) at java.base/java.lang.Thread.run(Thread.java:1575) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private static native long jdk.jpackage.internal.ExecutableRebrander.lockResource(java.lang.String) accessible: module jdk.jpackage does not "opens jdk.jpackage.internal" to unnamed module @3761e16e at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:388) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:364) :
👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into |
@alexeysemenyukoracle This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 129 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@alexeysemenyukoracle The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
…rectory 'DesktopFolder' is deprecated. Use the StandardDirectory element instead." WiX4 warning
…he PATH. When wix.exe is not in the PATH, jpackage uses %USERPROFILE% env variable to get user home directory. But jtreg removes it from the environment when running tests, so without wix.exe in the PATH all jpackage tests will fail on Windows. This makes it impossible to test jpackage with wix3. This patch addresses this issue by reading user home additionally from "java.home" system property.
…ols available and what bundlers are supported.
This reverts commit 00d7cc6.
… and Saxon HE (v12.4)
/label -build |
@magicus |
Correct.
They claim WiX5 is backward compatible with WiX4, i.e. WiX4 code should work with WiX5 toolkit. So I don't see a reason to introduce Wix5 ToolsetType now. |
…. All WiX source files from the resource directory should be copied to jpackage work directory before running wxi tools. jpackage should not change files in the resource directory.
…ile() does: create parent directory and replace output file if it exists.
Fixed WinL10nTest test failure. It didn't fail on my dev machine but failed in another environment. I thought it was sporadic but it turned out to be a bug in this PR. |
@@ -152,6 +153,16 @@ void addFilesToConfigRoot() throws IOException { | |||
super.addFilesToConfigRoot(); | |||
} | |||
|
|||
@Override | |||
List<String> getLoggableWixFeatures() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am missing something, but is it used? I only see call to base class WixFragmentBuilder::getLoggableWixFeatures
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WixFragmentBuilder::getLoggableWixFeatures
is equivalent to:
new Function<WixFragmentBuilder, List<String>>() {
public List<String> apply(WixFragmentBuilder obj) {
return obj.getLoggableWixFeatures();
}
}
An overridden WixAppImageFragmentBuilder#getLoggableWixFeatures() method will be called when WixAppImageFragmentBuilder instance is given.
@@ -41,8 +41,9 @@ resource.overrides-wix-file=Overrides WiX project file | |||
resource.shortcutpromptdlg-wix-file=Shortcut prompt dialog WiX project file | |||
resource.installdirnotemptydlg-wix-file=Not empty install directory dialog WiX project file | |||
resource.launcher-as-service-wix-file=Service installer WiX project file | |||
resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WiX v4 -> WiX v4/v5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The converter does exactly as described, it converts WiX v3 sources into WiX v4 format that can be used with WiX v4 and WiX v5. So I believe the description should remain unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but for error.no-wix-tools
I think we should add v5, in case if users sees this message when only v5 is installed.
|
||
error.no-wix-tools=Can not find WiX tools (light.exe, candle.exe) | ||
error.no-wix-tools=Can not find WiX tools. Was looking for WiX v3 light.exe and candle.exe or WiX v4 wix.exe and none was found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WiX v4 -> WiX v4/v5
Good catch. I'll update the code to make
|
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? 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? |
jpackage will detect the custom main.wxs is WiX4 format and pass it as is to
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. |
…entException if "wixVersion" is not WixToolkit#Wix3 or WixToolkit#Wix4. When/If we add another value to WixToolkit enum this will help not to miss adjusting all WiX version-specific code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. No more questions or comments.
/integrate |
Going to push as commit ba67ad6.
Your commit was automatically rebased without conflicts. |
@alexeysemenyukoracle Pushed as commit ba67ad6. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@alexeysemenyukoracle Related question: Generation of Quoting https://docs.oracle.com/en/java/javase/24/jpackage/override-jpackage-resources.html#GUID-62412365-821D-4736-A20D-70F2D47136D8, the
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. |
Definitely. Thank you for reporting the issue. Filed https://bugs.openjdk.org/browse/JDK-8355651 to track fixing the issue |
@koppor , "JabRef post-image" script has a couple of issues:
Unfortunately, issue n2 doesn't have a trivial solution like issue n1 because jpackage doesn't provide sufficient context to the post-image script. As a workaround, I'd embed a path to JabRef project root in the post-image script source. This will make it agnostic to the location of the project build directory and eliminate the need for I noticed there is no JabRef-post-image.wsf in the "main" branch anymore. Instead, you added a custom version of the "main.wxs" file. The script is still in the (v6.0-alpha2)[https://github.com/JabRef/jabref/blob/v6.0-alpha2/buildres/windows/JabRef-post-image.wsf] release though, I guess the fix is still relevant. I created a patch using |
Add support for WiX4 and WiX5 in jpackage.
jpackage supports WiX3, WiX4 and WiX5. It will pick WiX4/WiX5 if one of them is installed and there is WiX3 installed too. (Note: WiX4 and WiX5 are not supposed to be installed side-by-side, but if it happens, WiX5 will be preferred over WiX4).
Custom WiX3 sources will be automatically converted to WiX4 format if WiX4/WiX5 is used. The converter provides:
The converter is a XSLT stylesheet. The default converter is
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/wix3-to-wix4-conv.xsl
. It can be replaced with the custom converter by adding "wix-conv.xsl" file to the resource directory.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19318/head:pull/19318
$ git checkout pull/19318
Update a local copy of the PR:
$ git checkout pull/19318
$ git pull https://git.openjdk.org/jdk.git pull/19318/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19318
View PR using the GUI difftool:
$ git pr show -t 19318
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19318.diff
Webrev
Link to Webrev Comment