Fix ProGuard release build on the Java 25 toolchain

The Compose plugin defaults to ProGuard 7.8.0, which cannot process the Java 25
class files produced by jvmToolchain(25): it fails to load the JDK itself and
aborts with thousands of "can't find referenced class java.lang.Class" /
"the configuration refers to the unknown class 'java.lang.String'" warnings,
ending in "Please correct the above warnings first". Every release build has
been failing there since the toolchain bump.

Pin ProGuard 7.10.0 (7.9.0 added Java 25 support; 7.10.0 is the first release
that also understands the Kotlin 2.4 metadata this project compiles against).

Also ignore JOGL's JavaFX bridge. JetBrains Runtime ships jogl.all.jmod in its
jmods directory, which ProGuard loads as a library jar; its classes extend
program-side JavaFX classes, so JBR-based (macOS) builds fail with
"7 instances of library classes depending on program classes". Temurin JDKs
ship no such jmod, so that part is macOS/JBR-only.

Verified locally: :app:desktop:exportReleaseProguardForCi succeeds and exports
app/desktop/build/ci/proguard/.
This commit is contained in:
2026-10-16 15:18:04 +03:00
Unverified
parent 86802d36be
commit 994ef633cb
2 changed files with 21 additions and 0 deletions
+13
View File
@@ -240,6 +240,18 @@ fun stageWindowsJpackageRuntime(appImageRoot: File) {
/** Desktop compile target — must stay in sync with `kotlin { jvmToolchain(desktopJvmTarget) }`. */
private val desktopJvmTarget = 25
/**
* ProGuard version used by the Compose release tasks.
*
* The Compose plugin defaults to 7.8.0, which cannot process the Java 25 class files
* produced by `jvmToolchain(desktopJvmTarget)` — ProGuard then fails to load the JDK
* itself and reports `can't find referenced class java.lang.Class` /
* `the configuration refers to the unknown class 'java.lang.String'`.
* 7.9.0 added Java 25 support; 7.10.0 is the first release that also understands the
* Kotlin 2.4 metadata this project compiles against.
*/
private val proguardVersion = "7.10.0"
fun resolvePackagingJdkHome(): String {
// The desktop module compiles to jvmToolchain(desktopJvmTarget) classes; jpackage must
// bundle a runtime >= that or the installed app dies at launch with
@@ -378,6 +390,7 @@ compose.desktop {
javaHome = resolvePackagingJdkHome()
buildTypes.release.proguard {
version = proguardVersion
configurationFiles.from(project.file("proguard-rules.pro"))
}
+8
View File
@@ -39,3 +39,11 @@
<fields>;
<init>(...);
}
# JetBrains Runtime bundles a `jogl.all.jmod` (JOGL, incl. its JavaFX bridge) in its jmods
# directory, which ProGuard picks up as a library jar. Those JOGL classes extend JavaFX
# classes that are ProGuard *program* inputs, so ProGuard reports 7x
# "library class com.jogamp.newt.javafx.* extends or implements program class javafx.*"
# and then aborts with "Please correct the above warnings first". The app never uses JOGL,
# so only that JavaFX bridge is ignored (JDKs without the jmod, e.g. Temurin, are unaffected).
-dontwarn com.jogamp.newt.javafx.**