From 0e5d1da8d23820ed2bea3d2e337f8dc7b83bc374 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Thu, 23 Apr 2026 10:13:27 -0500 Subject: [PATCH] fix(desktop): unbreak Windows launch + Pi-installable arm64 .deb (#5233) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: garthvh <1795163+garthvh@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- .../meshtastic/buildlogic/KotlinAndroid.kt | 22 +++------- desktop/proguard-rules.pro | 44 ++++++++++++++++--- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d7f8e012..df78d3306 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -258,7 +258,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest, ubuntu-24.04, ubuntu-24.04-arm] + os: [macos-latest, windows-latest, ubuntu-22.04, ubuntu-22.04-arm] env: GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }} GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }} diff --git a/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt index 088ca0d25..e3dd8db15 100644 --- a/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt @@ -72,22 +72,12 @@ internal fun Project.configureKotlinAndroid(commonExtension: CommonExtension) { /** Configure Kotlin Multiplatform options */ internal fun Project.configureKotlinMultiplatform() { - // Skiko is an internal CMP implementation detail; third-party KMP libraries - // (e.g. coil3) can carry an older skiko transitive requirement that Gradle - // upgrades to the CMP-bundled version, triggering a "Skiko dependencies' - // versions are incompatible" warning from CMP's compatibility checker. - // Force the version to match CMP so the checker sees a consistent graph. - // Pinned here rather than in the version catalog because this plugin is the - // only consumer — bump together with the compose-multiplatform version. - val skikoVersion = "0.144.5" - configurations.configureEach { - resolutionStrategy.eachDependency { - if (requested.group == "org.jetbrains.skiko") { - useVersion(skikoVersion) - because("Align Skiko with the version bundled by Compose Multiplatform") - } - } - } + // Note: we used to force `org.jetbrains.skiko` to a hard-coded version here to + // align coil3's older skiko requirement with CMP's. As of CMP 1.11.x the + // compose-desktop module publishes `{strictly }` constraints on + // skiko, so Gradle resolves the conflict naturally. A hard-coded force would + // silently downgrade skiko on the next CMP bump and break the renderer — + // so we let CMP own the version. extensions.configure { // Standard KMP targets for Meshtastic diff --git a/desktop/proguard-rules.pro b/desktop/proguard-rules.pro index 77ea4d6f2..9a9653e87 100644 --- a/desktop/proguard-rules.pro +++ b/desktop/proguard-rules.pro @@ -42,13 +42,7 @@ -dontprocesskotlinmetadata # ---- Entry point ------------------------------------------------------------ - --keep class org.meshtastic.desktop.MainKt { *; } - -# ---- Ktor Java engine (desktop-only; Android uses OkHttp) ------------------- -# io.ktor.client.engine.java ships consumer rules; the shared -# HttpClientEngineFactory ServiceLoader keep in shared-rules.pro covers the -# reflective discovery path. +# (org.meshtastic.desktop.MainKt is covered by the package-wide keep below.) # ---- Meshtastic desktop host shell ------------------------------------------ @@ -70,6 +64,42 @@ -dontwarn kotlin.concurrent.atomics.** -dontwarn kotlin.uuid.UuidV7Generator +# ---- Library consumer rules ------------------------------------------------ +# The compose-jb gradle plugin auto-injects `default-compose-desktop-rules.pro` +# (bundled inside org.jetbrains.compose:compose-gradle-plugin) into every +# desktop ProGuard run. That file already covers: +# - kotlin.**, kotlinx.coroutines.** (incl. SwingDispatcherFactory ServiceLoader) +# - org.jetbrains.skiko.**, org.jetbrains.skia.** +# - kotlinx.serialization.** (incl. @Serializable companion keeps) +# - kotlinx.datetime.** +# - androidx.compose.runtime SnapshotStateKt + Material3 SliderDefaults +# So we DO NOT re-declare those here. Source of truth: +# https://github.com/JetBrains/compose-multiplatform/blob/master/gradle-plugins/compose/src/main/resources/default-compose-desktop-rules.pro +# +# However, the standalone ProGuard 7.7.0 that compose-jb invokes does NOT +# auto-import library `META-INF/proguard/*.pro` consumer rules from arbitrary +# jars (only R8/Android does). So any consumer-rule pattern outside the bundled +# defaults above must be copied here manually (see Ktor SL block below). + +# ---- androidx.sqlite bundled driver (JNI native bridge) --------------------- +# BundledSQLiteDriver loads `libsqliteJni` and the native code calls back into +# JVM-land via methods on `BundledSQLiteDriverKt` (e.g. `nativeThreadSafeMode`) +# and member methods on `BundledSQLiteDriver` itself. Because those JVM symbols +# are referenced only from native code, ProGuard removes them as unused; the +# native loader then crashes with `NoSuchMethodError: ... name or signature does +# not match`. Keep the whole driver package — it's small and entirely needed at +# runtime once the bundled SQLite driver is selected. +-keep class androidx.sqlite.driver.bundled.** { *; } +-keepclassmembers class androidx.sqlite.driver.bundled.** { native ; *; } + +# ---- Ktor serialization extension providers (ServiceLoader) ----------------- +# io.ktor.serialization.kotlinx-json discovers KotlinxSerializationJsonExtensionProvider +# via META-INF/services/io.ktor.serialization.kotlinx.KotlinxSerializationExtensionProvider. +# Without this keep the desktop HttpClient init throws ServiceConfigurationError +# at first request; on Windows jpackage's launcher swallows the trace and +# surfaces it as "Failed to launch JVM". +-keep class * implements io.ktor.serialization.kotlinx.KotlinxSerializationExtensionProvider { *; } + # ---- Vico 3.2.0-next.1 ColorScale (CMP API drift) --------------------------- # Vico's new ColorScale* classes (ColorScaleShader, ColorScaleAreaFill, # ColorScaleLineFill) reference CMP UI graphics members that don't exist in