Skip to content

fix(desktop): unbreak Windows launch + Pi-installable arm64 .deb#5233

Merged
jamesarich merged 1 commit into
mainfrom
fix/desktop-launch-and-deb
Apr 23, 2026
Merged

fix(desktop): unbreak Windows launch + Pi-installable arm64 .deb#5233
jamesarich merged 1 commit into
mainfrom
fix/desktop-launch-and-deb

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Why

Two production reports against the desktop release artifacts:

  1. Windows installer crashes immediately with Failed to launch JVM — jpackage's launcher is hiding the real exception.
  2. arm64 .deb won't install on Raspberry Pi OS / Debian 12 — apt complains about missing libasound2t64 and libpng16-16t64.

What

ProGuard (unbreaks Windows + reproduced macOS launch crash)

Verified locally that the desktop release was failing in two places, both stripped by ProGuard because the only references are non-JVM (ServiceLoader / JNI):

  • Ktor JSON ServiceLoaderio.ktor.serialization.kotlinx.KotlinxSerializationJsonExtensionProvider. HttpClient { install(ContentNegotiation) } throws ServiceConfigurationError on first request.
  • androidx.sqlite bundled driver — native libsqliteJni calls back into BundledSQLiteDriverKt.nativeThreadSafeMode(); ProGuard removes it as unused. Room can't open any DB.

Added narrowly-scoped -keep rules for both.

Audit + cleanup

Compared our desktop/proguard-rules.pro against JetBrains' bundled default-compose-desktop-rules.pro, which the compose-jb gradle plugin auto-injects into every desktop ProGuard run. That file already covers kotlin.**, kotlinx.coroutines.** (including the SwingDispatcherFactory ServiceLoader for Dispatchers.Main), org.jetbrains.skiko/skia.**, kotlinx.serialization, and kotlinx.datetime. Dropped our redundant copies and added a comment pointing at the upstream file.

build-logic skiko force removed

KotlinAndroid.configureKotlinMultiplatform was hard-coding org.jetbrains.skiko to 0.144.5 to silence CMP's incompatibility warning. CMP 1.11.x now publishes {strictly} constraints on skiko, so Gradle resolves the conflict naturally — the manual force is redundant today and would silently downgrade skiko (and break the renderer) on the next CMP bump.

Linux .deb runners

Switched the desktop release matrix to ubuntu-22.04 / ubuntu-22.04-arm so jpackage records the original Debian dep names (libasound2, libpng16-16) rather than Ubuntu's *t64 transitional package names from the time_t64 transition, which don't exist on Debian 12 Bookworm / Pi OS.

Verified locally

  • ./gradlew :desktop:packageReleaseDistributionForCurrentOS spotlessApply detekt — green
  • macOS dmg launches, fetches firmware list over HTTPS, opens Room DB, starts mesh service.
  • Windows / Pi install verification still depends on this PR's CI artifacts.

The desktop release build was crashing on first launch with two distinct
ProGuard-related faults that the standalone ProGuard 7.7.0 used by
compose-jb hides behind jpackage's terse 'Failed to launch JVM' message:

1. Ktor JSON's ServiceLoader provider
   (KotlinxSerializationJsonExtensionProvider) was tree-shaken because
   no JVM symbol references it directly — only META-INF/services does.
   Add an explicit '-keep class * implements ...' rule.
2. androidx.sqlite's bundled native driver lost its JNI bridge methods
   (e.g. BundledSQLiteDriverKt.nativeThreadSafeMode) for the same
   reason — only native code calls them. Keep the whole driver package.

While here, audit and slim the rest of desktop/proguard-rules.pro
against JetBrains' bundled default-compose-desktop-rules.pro. The
compose-jb gradle plugin auto-injects that file into every desktop
ProGuard run; it already covers kotlin.**, kotlinx.coroutines.** (incl.
the SwingDispatcherFactory ServiceLoader for Dispatchers.Main),
org.jetbrains.skiko/skia.**, kotlinx.serialization, and kotlinx.datetime.
Drop our redundant copies of those rules and add a comment pointing at
the upstream source of truth.

Also drop a brittle 'org.jetbrains.skiko -> 0.144.5' force in the KMP
convention plugin: CMP 1.11.x publishes '{strictly}' constraints on
skiko, so Gradle handles the conflict naturally. The hard-coded version
would silently downgrade skiko on the next CMP bump and break the
renderer.

Linux .deb: switch the desktop release matrix to ubuntu-22.04 /
ubuntu-22.04-arm so jpackage records the non-t64 dep names
(libasound2, libpng16-16) that exist on Debian 12 / Raspberry Pi OS,
not just on Ubuntu 24.04+.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added bugfix PR tag repo Repository maintenance labels Apr 23, 2026
@jamesarich jamesarich enabled auto-merge April 23, 2026 14:56
@jamesarich jamesarich added this pull request to the merge queue Apr 23, 2026
Merged via the queue into main with commit 37ac422 Apr 23, 2026
12 checks passed
@jamesarich jamesarich deleted the fix/desktop-launch-and-deb branch April 23, 2026 15:29
Copilot AI pushed a commit that referenced this pull request Apr 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag repo Repository maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant