Skip to content

Commit 931c6cd

Browse files
committed
chore: Update ProGuard rules for Compose Desktop
1 parent b28015c commit 931c6cd

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

composeApp/compose-desktop.pro

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
-printmapping build/proguard-mapping.txt
88

9+
-keep class androidx.datastore.*.** {*;}
10+
911
# Keep Ktor classes
1012
-keep class io.ktor.** { *; }
1113
-dontnote io.ktor.**
@@ -28,7 +30,7 @@
2830
-dontwarn kotlin.reflect.jvm.internal.**
2931

3032
# Keep necessary Kotlin attributes
31-
-keepattributes Signature, *Annotation*
33+
-keepattributes Annotation, Signature, *Annotation*
3234

3335
# Logging classes, if logging is required
3436
-keep class org.slf4j.** { *; }
@@ -40,17 +42,21 @@
4042
-keep class com.jthemedetecor.** { *; }
4143
-keep class com.jthemedetecor.MacOSThemeDetector$* { *; }
4244

43-
# Annotated interfaces (including methods which are also kept in implementing classes)
44-
-keepattributes Annotation
45-
-keepattributes *Annotation*
45+
# Theme detector
46+
-dontwarn java.awt.*
47+
-keep class com.sun.jna.* { *; }
48+
-keepclassmembers class * extends com.sun.jna.* { public *; }
4649

50+
# ServiceLoader support
51+
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
52+
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
4753

48-
# Most of volatile fields are updated with AFU and should not be mangled
49-
-keepclassmembers class kotlinx.coroutines.** {
54+
# Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater
55+
-keepclassmembers class kotlin.coroutines.SafeContinuation {
5056
volatile <fields>;
5157
}
5258

53-
# These classes are only required by kotlinx.coroutines.debug.AgentPremain, which is only loaded when
59+
# These classes are only required by kotlinx.coroutines.debug.internal.AgentPremain, which is only loaded when
5460
# kotlinx-coroutines-core is used as a Java agent, so these are not needed in contexts where ProGuard is used.
5561
-dontwarn java.lang.instrument.ClassFileTransformer
5662
-dontwarn sun.misc.SignalHandler
@@ -61,6 +67,9 @@
6167
# The case when it is not available is hidden in a `try`-`catch`, as well as a check for Android.
6268
-dontwarn java.lang.ClassValue
6369

70+
# An annotation used for build tooling, won't be directly accessed.
71+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
72+
6473
# Additional dontwarn rules for common issues
6574
-dontwarn java.awt.**
6675
-dontwarn javax.annotation.**

0 commit comments

Comments
 (0)