Closed makeevrserg closed 1 month ago
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
In case someone will be interested in more detailed tutorial - I've created one.
btw related to #518
Background
Currently, Compose Desktop provides limited set of binaries: [Dmg, Msi, Deb]. Furthermore, macos and linux binaries can only be built on macos/linux.
Bundled .jar can supply us with multiplatform .jar executable which can be built on any platform.
The documentation itself lacks information about .jar packaging. In my opinione, there should be section or another .MD document with tutorial about shadowJar and it's ProGuard obfuscation.
I don't have a knowledge and skill to create high-quality documentation, thus I'm creating this issue with required information about shadowJar packaging with some pitfalls and not PR.
Here's sample guide to enable shadowJar packaging from my project:
Setup
Firstly, to create shadow, we need to specify excactly
kotlin.jvm
plugin and notkotlin.multiplatform
. This is required because shadowJar plugin doesn't work withkotlin.multiplatform
. It requers jvm.Secondly, to enable binaries for all native targets - we need to specify
compose.desktop.ANY_OS
:Then, we need to proceed default Compose Desktop Setu from official README.
Setup Shadow
Now, we need to setup shadowJar.
Setup ProGuard 1
To setup proguard, we need to specify an input job - our shadowJar task. We also need to add configuration .pro files from original ComposeDesktop repo
Also, when build, we shouldn't use JetbrainsJDK because it lacks some JDK modules.
Setup Proguard 2
Now we need to run proguard to see what we're missing
With info ProGuard task will tell you what classes you're missing. You will add it into
proguard-rules.pro
. To understand this, refer to official proguard documentation.After all this steps, obfuscated .jar executable for all os's will be created and you're ready to go.