Add missing jpackage options
Describe proposed changes and the issue being fixed
Adds additional jpackage options, introduced in jdk 17 and 21:
- --win-shortcut-prompt (from jdk 17)
- --win-update-url (from jdk 17)
- --linux-package-deps (from jdk 17) - (although I am unsure how to use that option, naming suggests an argument but there is no argument documented)
- --mac-dmg-content (from jdk 21)
Fixes
- https://youtrack.jetbrains.com/issue/CMP-7580
- https://youtrack.jetbrains.com/issue/CMP-2236
Testing
Describe how you tested your changes. If possible and needed:
- Test it on a sample project
- Write unit tests
- Provide a code snippet
This should be tested by QA
Release Notes
Features - Desktop
- Native distribution: added
jpackageoptions--win-shortcut-prompt,--win-update-url,--linux-package-depsand--mac-dmg-content
Not tested yet, only made sure to copy the values from documentation. Not sure how I can make a snapshot build from this to test in a sample projects. If there is an easy way to publish this as snapshot I have a sample repo to test these changes
Please add a reference to https://youtrack.jetbrains.com/issue/CMP-2236 in the PR description
I haven't used jpackage on Linux, but https://github.com/petr-panteleyev/jpackage-gradle-plugin/ suggests that the --linux-package-deps option might be boolean.
Could you please verify it and update documentation, or remove it until its meaning is clear.
I agree, the documentation is bad there. I just spun up an ubuntu docker container to check this.
I could confirm that the option accepts parameters and those affect the output .deb:
This is the .deb I got with this jpackage command: jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar --linux-package-deps ffmpeg
dpkg -I yt-dlp-compose_1.0_arm64-ffmpeg-dep.deb
new Debian package, version 2.0.
size 37176504 bytes: control archive=1127 bytes.
531 bytes, 11 lines control
867 bytes, 38 lines * postinst #!/bin/sh
819 bytes, 31 lines * postrm #!/bin/sh
631 bytes, 35 lines * preinst #!/bin/sh
789 bytes, 39 lines * prerm #!/bin/sh
Package: yt-dlp-compose
Version: 1.0
Section: misc
Maintainer: Unknown <Unknown>
Priority: optional
Architecture: arm64
Provides: yt-dlp-compose
Description: yt-dlp-compose
Depends: libasound2t64, libbrotli1, libbsd0, libbz2-1.0, libc6, libfreetype6, libgcc-s1, libgif7, libglib2.0-0t64, libgraphite2-3, libharfbuzz0b, libjpeg-turbo8, liblcms2-2, libmd0, libpcre2-8-0, libpcsclit
e1, libpng16-16t64, libstdc++6, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxi6, libxrender1, libxtst6, zlib1g , ffmpeg
Installed-Size: 160957
While the .deb without dependencies does not have this dependency (jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar):
dpkg -I yt-dlp-compose_1.0_arm64-without-deps.deb
new Debian package, version 2.0.
size 37177420 bytes: control archive=1122 bytes.
523 bytes, 11 lines control
867 bytes, 38 lines * postinst #!/bin/sh
819 bytes, 31 lines * postrm #!/bin/sh
631 bytes, 35 lines * preinst #!/bin/sh
789 bytes, 39 lines * prerm #!/bin/sh
Package: yt-dlp-compose
Version: 1.0
Section: misc
Maintainer: Unknown <Unknown>
Priority: optional
Architecture: arm64
Provides: yt-dlp-compose
Description: yt-dlp-compose
Depends: libasound2t64, libbrotli1, libbsd0, libbz2-1.0, libc6, libfreetype6, libgcc-s1, libgif7, libglib2.0-0t64, libgraphite2-3, libharfbuzz0b, libjpeg-turbo8, liblcms2-2, libmd0, libpcre2-8-0, libpcsclite1, libpng16-16t64, libstdc++6, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxi6, libxrender1, libxtst6, zlib1g
Installed-Size: 161654
Somewhat incomplete history of commands in case you want to reproduce (missing apt install openjdk tmux, but this will depend on the image)
1 git clone https://github.com/StefanLobbenmeier/yt-dlp-compose.git
2 apt install git
3 git clone https://github.com/StefanLobbenmeier/yt-dlp-compose.git
4 cd yt-dlp-compose/
5 ./gradlew assemble
6 ls
7 ls build
8 ls build/libs/
9 ls build/libs/yt-dlp-compose-1.0.0.jar
10 jpackage build/libs/yt-dlp-compose-1.0.0.jar
11 jpackage --type jlink --name yt-dlp-compose --main-jar build/libs/yt-dlp-compose-1.0.0.jar
12 jpackage --type jlink --name yt-dlp-compose --main-jar build/libs/yt-dlp-compose-1.0.0.jar --input build/libs
13 apt search jlink
14 jpackage --type deb --name yt-dlp-compose --main-jar build/libs/yt-dlp-compose-1.0.0.jar --input build/libs
15 jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar
16 apt install fakeroot
17 jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar
18 apt install objcopy
19 apt search objcopy
20 apt install binutils
21 jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar
22 ls
23 mv yt-dlp-compose_1.0_arm64.deb yt-dlp-compose_1.0_arm64-without-deps.deb
24 jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar --linux-package-deps openjdk-21-jdk
25 mv yt-dlp-compose_1.0_arm64.deb yt-dlp-compose_1.0_arm64-openjdk-dep.deb
26 jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar --linux-package-deps ffmpeg
27 dpkg -I package.deb
28 dpkg -I yt-dlp-compose_1.0_arm64-openjdk-dep.deb
29 mv yt-dlp-compose_1.0_arm64.deb yt-dlp-compose_1.0_arm64-ffmpeg-dep.deb
30 dpkg -I yt-dlp-compose_1.0_arm64-ffmpeg-dep.deb
31 history
Just some more tests, you can add multiple dependencies separated by comma: --linux-package-deps "foo, bar"
Depends: libasound2t64, libbrotli1, libbsd0, libbz2-1.0, libc6, libfreetype6, libgcc-s1, libgif7, libglib2.0-0t64, libgraphite2-3, libharfbuzz0b, libjpeg-turbo8, liblcms2-2, libmd0, libpcre2-8-0, libpcsclite1, libpng16-16t64, libstdc++6, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxi6, libxrender1, libxtst6, zlib1g , foo, bar
And just putting it there without arguments does not add any binaries:
jpackage --type deb --name yt-dlp-compose --input build/libs --main-jar yt-dlp-compose-1.0.0.jar --linux-package-deps
Depends: libasound2t64, libbrotli1, libbsd0, libbz2-1.0, libc6, libfreetype6, libgcc-s1, libgif7, libglib2.0-0t64, libgraphite2-3, libharfbuzz0b, libjpeg-turbo8, liblcms2-2, libmd0, libpcre2-8-0, libpcsclit e1, libpng16-16t64, libstdc++6, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxi6, libxrender1, libxtst6, zlib1g
But this only works when its the last argument, otherwise it consumes the next one:
jpackage --type deb --name yt-dlp-compose --input build/libs --linux-package-deps --main-jar yt-dlp-compose-1.0.0.jar
Error: Invalid Option: [yt-dlp-compose-1.0.0.jar]
One more evidence that behaviour is different from documentation - this is the definition of the argument in code, its a string argument:
https://github.com/openjdk/jdk/blob/fea5f2b1458cdd53f437e59caaffaa6e22fb59a7/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBundler.java#L366-L372
could this be merged? Edit: I think --app-content is missing and it allows to put resources into app image destination dir. Maybe adding a jpackageArgs (like jvmArgs) could solve all of this and we could pass any jpackage args to let us fully customize the distributable
Yeah would be nice to get this merged soon 😄 I guess we are waiting for @igordmn review to complete?