From 5f8732b6cc1629344a228fd1fbbc9ed95d01714f Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Fri, 16 Oct 2026 21:58:19 +0300 Subject: [PATCH] Stage each packaging host's own Skiko/JavaFX natives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The beta7 desktop builds cannot start. Both failures the user reported (macOS arm64 and Linux arm64) are the same bug: ERROR: [Desktop] uncaught on main Failed to loade library .../libskiko-macos-arm64.dylib Caused by: java.lang.UnsatisfiedLinkError: Can't load library ProGuard runs once, on ubuntu-latest, and its output is shipped to every packaging job. But the Compose desktop runtime classpath is host-specific: that single ProGuard run froze in skiko-awt-runtime-linux-x64 and javafx-*-27-linux, and nothing for any other target. Inspecting the published macOS arm64 DMG confirmed it — 140 jars, the entire ProGuard set, with skiko-awt-runtime-linux-x64 as the only Skiko runtime and no libskiko-*-arm64 anywhere in the bundle, plus no JavaFX natives either. The macOS x64 build is broken the same way; Linux x64 is the only target that happened to match, and the Windows installers shipped Linux natives too. stageCiPrebuiltProguard now also stages the packaging host's own natives (skiko-awt-runtime--, javafx-*--) from its resolved runtimeClasspath. Skiko and JavaFX each pick their library by os/arch, so the foreign Linux copies stay inert and cost only some bundle size. The task fails loudly if a host resolves no natives at all. Verified locally end-to-end with a prebuilt-ProGuard packaging run: Contents/app/libskiko-macos-arm64.dylib (21.3 MB) is now present, which is the exact path Skiko failed to load before. --- app/desktop/build.gradle.kts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/desktop/build.gradle.kts b/app/desktop/build.gradle.kts index 2680e0a..9c49466 100644 --- a/app/desktop/build.gradle.kts +++ b/app/desktop/build.gradle.kts @@ -932,16 +932,43 @@ tasks.register("exportReleaseProguardForCi") { into(ciProguardExportDir) } +/** + * Platform-native artifacts resolved for *this* host, e.g. `skiko-awt-runtime-macos-arm64-*.jar` + * and `javafx-graphics-27-mac-aarch64.jar`. Skiko and JavaFX each pick their library by + * os/arch at runtime, so a bundle simply needs the matching jars on the classpath. + */ +private val platformNativeJar = Regex( + """^(skiko-awt-runtime-.+|javafx-[a-z]+-\d+-(?:linux|mac|win|windows)(?:-[a-z0-9]+)?)\.jar$""", + RegexOption.IGNORE_CASE, +) + +private val hostPlatformNatives = providers.provider { + configurations.getByName("runtimeClasspath").files.filter { platformNativeJar.matches(it.name) } +} + tasks.register("stageCiPrebuiltProguard") { group = "compose desktop" description = "Stage downloaded CI ProGuard jars into compose release tmp before packaging." onlyIf { useCiPrebuiltProguard() } from(ciPrebuiltProguardDir) + // ProGuard runs once, on Linux x64, so the prebuilt jars carry that host's natives + // (skiko-awt-runtime-linux-x64, javafx-*-linux) and nothing for any other target. Packaging + // that set as-is ships an app with no natives of its own, which dies on startup with + // "UnsatisfiedLinkError: Can't load library .../libskiko--". Add this host's own + // natives alongside them; Skiko and JavaFX load by os/arch, so the foreign copies are inert. + from(hostPlatformNatives) into(releaseProguardOutputDir) doFirst { check(ciPrebuiltProguardDir.get().asFile.isDirectory) { "Missing prebuilt ProGuard at ${ciPrebuiltProguardDir.get().asFile}" } + val natives = hostPlatformNatives.get() + check(natives.isNotEmpty()) { + "No platform-native artifacts on this host's runtimeClasspath; the app would ship " + + "without Skiko/JavaFX natives. Looked for ${platformNativeJar.pattern}." + } + logger.lifecycle("Staged ${natives.size} platform-native jars for this host:") + natives.forEach { logger.lifecycle(" ${it.name}") } } }