Skip to content

Conversation

@StefanLobbenmeier
Copy link

@StefanLobbenmeier StefanLobbenmeier commented Feb 9, 2025

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

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 jpackage options --win-shortcut-prompt, --win-update-url, --linux-package-deps and --mac-dmg-content
@StefanLobbenmeier StefanLobbenmeier marked this pull request as ready for review February 9, 2025 17:02
@StefanLobbenmeier
Copy link
Author

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

@StefanLobbenmeier StefanLobbenmeier changed the title Add missing jpackage options, fix cmp 7580 Feb 9, 2025
@MatkovIvan MatkovIvan requested a review from kropp February 14, 2025 09:05
@kropp
Copy link
Member

kropp commented Feb 14, 2025

Please add a reference to https://youtrack.jetbrains.com/issue/CMP-2236 in the PR description

@kropp
Copy link
Member

kropp commented Feb 14, 2025

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.

@StefanLobbenmeier
Copy link
Author

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
@StefanLobbenmeier
Copy link
Author

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]
@StefanLobbenmeier
Copy link
Author

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

@kropp kropp requested a review from igordmn February 17, 2025 11:34
@ApoloApps
Copy link

ApoloApps commented May 8, 2025

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

@StefanLobbenmeier
Copy link
Author

Yeah would be nice to get this merged soon 😄 I guess we are waiting for @igordmn review to complete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants