You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The task jpackageImage creates an application image.
The task jpackage creates an MSI Installer of the application image (at least on Windows).
Requirement: I need to sign the executable which is wrapped in the MSI installer.
I can sign the MSI installer after the task jpackage is finished. However, virus scanner seem to need a signed executable in some cases as well. Hence I tried to first run jpackageImage , afterwards I signed the executable and after that I called jpackage to pack the result.
Unfortunately jpackage depends on jpackageImage and creates again a new application image which is not signed. How can I achieve that the already existing application image is used instead of creating a new one.
I'm adding this as enhancement because, although really it was just a question, similar plugins do just have a simple way to get things signed as they are built, and, in some cases, jpackage itself can be instructed to do signing.
Things to think about:
Assuming this will be implemented using signtool:
Which parameters are necessary?
Which optional parameters are worth adding?
How should the overall API look?
(Try to fit with the way it will work for macOS - on macOS, jpackage just has additional flags.
A future jpackage may gain the same for Windows for parity.)
Thanks @vewert for your input 👍
It helped me to find a solution that worked for me.
I have an external bat script that I would like to start. Unfortunately with your solution I did not manage to start the script within tasks.jpackageImage (Note: I am a noob in Gradle).
The solution I found is very similar. For the record I post it below...
The jsign-exe.bat is very simple. The only issue I encountered was that the exe file was set to read-only. Hence you need to remove this flag and than sign it with your tools. Something like this
How should the overall API look?
(Try to fit with the way it will work for macOS - on macOS, jpackage just has additional flags.
A future jpackage may gain the same for Windows for parity.)
In order to sign the EXE within the MSI, I have overridden the package resource Post-image script, project-name-post-image.wsf. This is a custom script that is executed after the application image is created and before the MSI installer is built for both .msi and .exe packages.
Activity
vewert commentedon Apr 13, 2023
I sign it within the jpackageImageTask (kotlin dsl):
Note, you can ignore the
osdetectorstuff, I have that in because I also build for macOS.Hopefully, that helps
hakanai commentedon Apr 14, 2023
I'm adding this as enhancement because, although really it was just a question, similar plugins do just have a simple way to get things signed as they are built, and, in some cases, jpackage itself can be instructed to do signing.
Things to think about:
signtool:(Try to fit with the way it will work for macOS - on macOS,
jpackagejust has additional flags.A future jpackage may gain the same for Windows for parity.)
danielpeintner commentedon Apr 14, 2023
Thanks @vewert for your input 👍
It helped me to find a solution that worked for me.
I have an external bat script that I would like to start. Unfortunately with your solution I did not manage to start the script within
tasks.jpackageImage(Note: I am a noob in Gradle).The solution I found is very similar. For the record I post it below...
The
jsign-exe.batis very simple. The only issue I encountered was that the exe file was set to read-only. Hence you need to remove this flag and than sign it with your tools. Something like thisHope this might be useful for others.
@hakanai see above for options I need to sign..
DJViking commentedon Apr 14, 2023
jpackage builds both an MSI and an EXE for Windows.
To sign the EXE I have this small task:
In order to sign the EXE within the MSI, I have overridden the package resource Post-image script, project-name-post-image.wsf. This is a custom script that is executed after the application image is created and before the MSI installer is built for both .msi and .exe packages.
https://docs.oracle.com/en/java/javase/16/jpackage/override-jpackage-resources.html#GUID-405708DC-0243-49FC-84D9-B2A7F0A011A9
vewert commentedon Apr 14, 2023
I used to use signtool, but now I use the jsign plugin: https://ebourg.github.io/jsign/
It can be called from within the jpackageImage task.
I also noticed about the read-only problem (sorry I should have mentioned that problem).
Here is my more complete code, including jsign and removing read-only: