Has anyone tried using Kodein-Di with progaurd on ...
# kodein
m
Has anyone tried using Kodein-Di with progaurd on Desktop/JVM? I'm trying to use it with a Compose Desktop app. I added the same config as per the docs (which works on Android)
Copy code
-keep, allowobfuscation, allowoptimization class org.kodein.type.TypeReference
-keep, allowobfuscation, allowoptimization class org.kodein.type.JVMAbstractTypeToken$Companion$WrappingTest

-keep, allowobfuscation, allowoptimization class * extends org.kodein.type.TypeReference
-keep, allowobfuscation, allowoptimization class * extends org.kodein.type.JVMAbstractTypeToken$Companion$WrappingTest
Still getting the runtime exception about an invalid type token when using the version processed via proguard. Works fine without obfuscation. Proguard reduces the package size from 160MB to 80MB, so definitely want to use proguard with KodeIn on JVM if possible
e
Are you using Proguard or R8? I'm guessing the docs were written for R8, which has largely superseded Proguard on Android (but is sometimes still referred to as Proguard).
m
I'm using Proguard on JVM (also using R8 on Android)
-keepattributes Signature made it happier... still testing
👍 1
e
Just in case you weren't aware, you can use R8 for JVM apps as well (not sure if there's a plugin for it or if it needs to be setup manually)
m
Interesting... though unfortunately it seems like it is not supported for jetpack compose desktop https://github.com/JetBrains/compose-multiplatform/issues/1604
e
It works with it, that issue is just asking for official support through the plugin
m
I think the problem isn't so much R8 vs. Proguard - I think its more that shrinking is defacto standard on Android, not really on JVM
On Android libs come with "proguard" rules (used by R8 in reality), but that's not included with Java libs
e.g. JVM libs
e
True, would be nice if that changed 😅
m
Indeed... I'm still trying to figure out where the size is going to land. At a minimum it seems to cut the total .deb size of a desktop app from 165 MB to 80MB (including the JVM libs)
Once I know what the right rules are for KodeIn/JVM, I'll put up an issue or pull request for doc change.
👍 1