Skip to content

Commit 2c390ba

Browse files
committed
build: update desktop build configuration and ProGuard rules
- Update commented-out Java home paths in build configuration - Add ProGuard rules to preserve volatile fields for coroutines - Add ProGuard rules for Swing dispatcher and JNA classes - Include ProGuard rules for SAX parsers and Jsoup - Configure ProGuard rules and warnings for OkHttp and its dependencies - Enable ignoring of ProGuard warnings
1 parent 8f833aa commit 2c390ba

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

composeApp/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ compose {
109109
application {
110110
mainClass = "com.meet.dev.analyzer.MainKt"
111111
// javaHome = System.getenv("JAVA_HOME")
112-
// javaHome = "/Users/meet/Library/Java/JavaVirtualMachines/ms-17.0.15/Contents/Home"
112+
// javaHome = "/Users/meet/Library/Java/JavaVirtualMachines/ms-17.0.17/Contents/Home"
113+
// javaHome = "/Users/meet/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.8+9/Contents/Home"
113114

114115
nativeDistributions {
115116
targetFormats(

composeApp/compose-desktop.pro

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
5555
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
5656

57+
# Most of volatile fields are updated with AFU and should not be mangled
58+
-keepclassmembers class kotlinx.coroutines.** {
59+
volatile <fields>;
60+
}
61+
5762
# Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater
5863
-keepclassmembers class kotlin.coroutines.SafeContinuation {
5964
volatile <fields>;
@@ -73,6 +78,34 @@
7378
# An annotation used for build tooling, won't be directly accessed.
7479
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
7580

81+
-keep class kotlinx.coroutines.swing.SwingDispatcherFactory {*;}
82+
83+
7684
# Additional dontwarn rules for common issues
7785
-dontwarn java.awt.**
78-
-dontwarn javax.annotation.**
86+
-dontwarn javax.annotation.**
87+
-keep class com.sun.jna.* { *; }
88+
-keepclassmembers class * extends com.sun.jna.* { public *; }
89+
90+
# Preserve SAX classes and interfaces
91+
-keep class javax.xml.parsers.SAXParserFactory { *; }
92+
-keep class org.xml.sax.** { *; }
93+
-keep interface org.xml.sax.** { *; }
94+
95+
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
96+
-dontwarn okhttp3.internal.platform.**
97+
-dontwarn org.conscrypt.**
98+
-dontwarn org.bouncycastle.**
99+
-dontwarn org.openjsse.**
100+
101+
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
102+
-dontwarn org.codehaus.mojo.animal_sniffer.*
103+
104+
# A resource is loaded with a relative path so the package of this class must be preserved.
105+
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
106+
107+
#Jsoup
108+
-keeppackagenames org.jsoup.nodes
109+
-keep public enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
110+
111+
-ignorewarnings

0 commit comments

Comments
 (0)