Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ abstract class ProguardSettings @Inject constructor(
val obfuscate: Property<Boolean> = objects.notNullProperty(false)
val optimize: Property<Boolean> = objects.notNullProperty(true)
val joinOutputJars: Property<Boolean> = objects.notNullProperty(false)
val minimizeKotlinStandardLibrary: Property<Boolean> = objects.notNullProperty(false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ private fun JvmApplicationContext.configureProguardTask(
dontoptimize.set(settings.optimize.map { !it })

joinOutputJars.set(settings.joinOutputJars)
minimizeKotlinStandardLibrary.set(settings.minimizeKotlinStandardLibrary)

dependsOn(unpackDefaultResources)
defaultComposeRulesFile.set(unpackDefaultResources.flatMap { it.resources.defaultComposeProguardRules })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ abstract class AbstractProguardTask : AbstractComposeDesktopTask() {
@get:Input
val dontoptimize: Property<Boolean?> = objects.nullableProperty()

@get:Optional
@get:Input
val minimizeKotlinStandardLibrary: Property<Boolean?> = objects.nullableProperty()

@get:Optional
@get:Input
val joinOutputJars: Property<Boolean?> = objects.nullableProperty()
Expand Down Expand Up @@ -125,6 +129,10 @@ abstract class AbstractProguardTask : AbstractComposeDesktopTask() {
writer.writeLn("-dontoptimize")
}

if (minimizeKotlinStandardLibrary.orNull == false) {
writer.writeLn("-keep class kotlin.** { *; }")
}

writer.writeLn("""
-keep public class ${mainClass.get()} {
public static void main(java.lang.String[]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-keep class kotlin.** { *; }
-keep class org.jetbrains.skia.** { *; }
-keep class org.jetbrains.skiko.** { *; }

Expand Down
13 changes: 13 additions & 0 deletions tutorials/Native_distributions_and_local_execution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -663,3 +663,16 @@ compose.desktop {
}
}
```

Minimizing the Kotlin library is disabled by default.
To minimize it,
set the following property via Gradle DSL:
```
compose.desktop {
application {
buildTypes.release.proguard {
minimizeKotlinStandardLibrary.set(true)
}
}
}
```