File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed
gradle-plugins/compose/src
test/test-projects/application/proguard Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 101101}
102102
103103# Kotlinx serialization, additional rules
104+
104105# Fixes:
105106# Exception in thread "main" kotlinx.serialization.SerializationException: Serializer for class 'SomeClass' is not found.
106107# Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
107108-keep class **$$serializer {
108109 *;
109110}
111+ -dontnote **$$serializer
112+
113+ # Fixes:
114+ # Exception in thread "main" kotlinx.a.g: Serializer for class 'MyClass' is not found
115+ # When `@InternalSerializationApi kotlinx.serialization.serializer` is used with obfuscation enabled
116+ -if @kotlinx.serialization.Serializable class **
117+ -keepclassmembers class <1>$** {
118+ kotlinx.serialization.KSerializer serializer(...);
119+ }
110120
111121# org.jetbrains.runtime:jbr-api
112122-dontwarn com.jetbrains.JBR**
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ plugins {
55 id " org.jetbrains.kotlin.jvm"
66 id " org.jetbrains.kotlin.plugin.compose"
77 id " org.jetbrains.compose"
8+ id " org.jetbrains.kotlin.plugin.serialization"
89}
910
1011dependencies {
1112 implementation " org.jetbrains.kotlin:kotlin-stdlib"
13+ implementation " org.jetbrains.kotlinx:kotlinx-serialization-core:1.9.0"
1214 implementation compose. desktop. currentOs
1315 implementation compose. material3
1416}
@@ -17,6 +19,9 @@ compose.desktop {
1719 application {
1820 mainClass = " Main"
1921 nativeDistributions {
22+ windows {
23+ console = true
24+ }
2025 targetFormats(TargetFormat.Dmg , TargetFormat.Msi , TargetFormat.Deb )
2126 }
2227
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ pluginManagement {
22 plugins {
33 id ' org.jetbrains.kotlin.jvm' version ' KOTLIN_VERSION_PLACEHOLDER'
44 id ' org.jetbrains.kotlin.plugin.compose' version ' KOTLIN_VERSION_PLACEHOLDER'
5+ id ' org.jetbrains.kotlin.plugin.serialization' version ' KOTLIN_VERSION_PLACEHOLDER'
56 id ' org.jetbrains.compose' version ' COMPOSE_GRADLE_PLUGIN_VERSION_PLACEHOLDER'
67 }
78 repositories {
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ import androidx.compose.ui.draw.clip
1010import androidx.compose.ui.graphics.Color
1111import androidx.compose.ui.graphics.Shape
1212import androidx.compose.ui.renderComposeScene
13+ import kotlinx.serialization.InternalSerializationApi
14+ import kotlinx.serialization.Serializable
15+ import kotlinx.serialization.serializer
1316import org.jetbrains.skia.EncodedImageFormat
1417import java.io.File
1518import java.util.*
@@ -34,6 +37,8 @@ object Main {
3437 .mapTo(TreeSet ()) { it.name }
3538 .joinToString(" \n " )
3639 workingDir.resolve(" main-methods.actual.txt" ).writeText(mainMethods)
40+
41+ serializer()
3742 }
3843
3944 @Composable
@@ -55,6 +60,13 @@ object Main {
5560 fun keptByKeepRule () {
5661 fillShape(Color .Blue , CircleShape )
5762 }
63+
64+ // https://youtrack.jetbrains.com/issue/CMP-8050/Desktop-runRelease-crash-when-upgrade-to-CMP-1.8.0-rc01#focus=Comments-27-11963863.0-0
65+ @OptIn(InternalSerializationApi ::class )
66+ fun serializer () {
67+ LoginRoute ::class .serializer()
68+ LoginRoute .serializer()
69+ }
5870}
5971
6072@Composable
@@ -73,4 +85,7 @@ fun fillShape(color: Color, shape: Shape){
7385 modifier = Modifier .clip(shape).fillMaxSize().background(color)
7486 )
7587 }
76- }
88+ }
89+
90+ @Serializable
91+ data class LoginRoute (val id : Long? = null )
You can’t perform that action at this time.
0 commit comments