Stage each packaging host's own Skiko/JavaFX natives

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-<os>-<arch>, javafx-*-<os>-<arch>) 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.
This commit is contained in:
2026-10-16 21:58:19 +03:00
Unverified
parent 0e7b1810fc
commit 5f8732b6cc
+27
View File
@@ -932,16 +932,43 @@ tasks.register<Copy>("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<Copy>("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-<os>-<arch>". 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}") }
}
}