|
| 1 | +# ========================================================================= |
| 2 | +# Linux Command Library - Compose Desktop ProGuard rules |
| 3 | +# Applied only to release builds via |
| 4 | +# compose.desktop.application.buildTypes.release.proguard |
| 5 | +# ========================================================================= |
| 6 | + |
| 7 | +# -------- Kotlin metadata / reflection hygiene -------- |
| 8 | +-keep class kotlin.Metadata { *; } |
| 9 | +-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod, RuntimeVisibleAnnotations, AnnotationDefault |
| 10 | +-dontwarn kotlin.** |
| 11 | +-dontwarn kotlinx.** |
| 12 | + |
| 13 | +# -------- Kotlin Coroutines (upstream coroutines.pro) -------- |
| 14 | +-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} |
| 15 | +-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} |
| 16 | +-keepclassmembers class kotlinx.coroutines.** { |
| 17 | + volatile <fields>; |
| 18 | +} |
| 19 | +-keepclassmembers class kotlin.coroutines.SafeContinuation { |
| 20 | + volatile <fields>; |
| 21 | +} |
| 22 | +-dontwarn java.lang.instrument.ClassFileTransformer |
| 23 | +-dontwarn sun.misc.SignalHandler |
| 24 | +-dontwarn java.lang.instrument.Instrumentation |
| 25 | +-dontwarn sun.misc.Signal |
| 26 | +-dontwarn java.lang.ClassValue |
| 27 | +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement |
| 28 | + |
| 29 | +# -------- kotlinx.serialization (upstream rules/common.pro) -------- |
| 30 | +-keepclassmembers @kotlinx.serialization.Serializable class ** { |
| 31 | + static ** Companion; |
| 32 | +} |
| 33 | +-if @kotlinx.serialization.internal.NamedCompanion class * |
| 34 | +-keepclassmembers class * { |
| 35 | + static <1> *; |
| 36 | +} |
| 37 | +-if @kotlinx.serialization.Serializable class ** { |
| 38 | + static **$* *; |
| 39 | +} |
| 40 | +-keepclassmembers class <2>$<3> { |
| 41 | + kotlinx.serialization.KSerializer serializer(...); |
| 42 | +} |
| 43 | +-if @kotlinx.serialization.Serializable class ** { |
| 44 | + public static ** INSTANCE; |
| 45 | +} |
| 46 | +-keepclassmembers class <1> { |
| 47 | + public static <1> INSTANCE; |
| 48 | + kotlinx.serialization.KSerializer serializer(...); |
| 49 | +} |
| 50 | +-keepclassmembers public class **$$serializer { |
| 51 | + private ** descriptor; |
| 52 | +} |
| 53 | +-dontnote kotlinx.serialization.** |
| 54 | +-dontwarn kotlinx.serialization.internal.ClassValueReferences |
| 55 | + |
| 56 | +# -------- Type-safe navigation routes -------- |
| 57 | +# Route.kt declares a @Serializable sealed class Route with data object/class |
| 58 | +# subtypes used as NavHost type-safe destinations. Navigation Compose looks up |
| 59 | +# the generated $serializer via reflection from the KClass, so the route types |
| 60 | +# and their generated serializers must survive shrinking. |
| 61 | +-keep @kotlinx.serialization.Serializable class com.linuxcommandlibrary.app.Route |
| 62 | +-keep @kotlinx.serialization.Serializable class com.linuxcommandlibrary.app.Route$* { *; } |
| 63 | +-keepclassmembers class com.linuxcommandlibrary.app.Route$* { |
| 64 | + *** Companion; |
| 65 | + kotlinx.serialization.KSerializer serializer(...); |
| 66 | +} |
| 67 | + |
| 68 | +# -------- AndroidX Navigation (upstream navigation-common rules) -------- |
| 69 | +-keepclassmembers class ** implements androidx.navigation.NavArgs { |
| 70 | + public static *** fromBundle(android.os.Bundle); |
| 71 | +} |
| 72 | +-keep class * extends androidx.navigation.Navigator |
| 73 | +-keep class androidx.navigation.NavType { *; } |
| 74 | +-keep class androidx.navigation.CollectionNavType { *; } |
| 75 | +-keep class androidx.navigation.serialization.** { *; } |
| 76 | +-keepclassmembers class androidx.navigation.serialization.** { *; } |
| 77 | + |
| 78 | +# -------- Koin 4.x (no upstream rules file) -------- |
| 79 | +-keep class org.koin.** { *; } |
| 80 | +-keepclassmembers class org.koin.** { *; } |
| 81 | +-dontwarn org.koin.** |
| 82 | + |
| 83 | +# Keep our DI module declarations so Koin's factory lookups by KClass still work. |
| 84 | +-keep class com.linuxcommandlibrary.app.di.** { *; } |
| 85 | +-keep class com.linuxcommandlibrary.shared.platform.** { *; } |
| 86 | +-keep class com.linuxcommandlibrary.app.platform.** { *; } |
| 87 | + |
| 88 | +# Keep ViewModels (Koin resolves by KClass; lifecycle ViewModel requires default ctor access). |
| 89 | +-keep class * extends androidx.lifecycle.ViewModel { <init>(...); } |
| 90 | +-keepnames class * extends androidx.lifecycle.ViewModel |
| 91 | + |
| 92 | +# -------- Compose Material 3 / ProGuard Kotlin-2 metadata workaround -------- |
| 93 | +# Harmless once version.set("7.5.0") is in place; kept as defence-in-depth. |
| 94 | +-dontwarn androidx.compose.material.** |
| 95 | +-keep class androidx.compose.material3.** { *; } |
0 commit comments