I feel like i'm going crazy here :upside_down_face...
# compose-desktop
n
I feel like i'm going crazy here 🙃 When publishing a Compose Desktop app I vaguely remember reading some guidance somewhere that we shouldn't depend directly on compose.desktop.currentOs but instead depend on
compose.desktop.common
. I have an IntellIJ plugin I just wrote using Compose for Desktop and after publishing it using the
common
dependency I get a crash when trying to open it with the following error
org.jetbrains.skiko.LibraryLoadException: Cannot find libskiko-macos-arm64.dylib.sha256, proper native dependency missing.
Unsure if I hallucinated those guidelines or if I'm doing something else wrong 🙃
o
Don't know if it's the best way to do it but on my side, I made as many builds as targeted OS (macOS, Windows, Linux) using
compose.desktop.currentOs
n
What does that look like in your build file 👀
o
Copy code
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
    kotlin("jvm")
    id("org.jetbrains.compose")
}

dependencies {
    ...
    implementation(compose.desktop.currentOs)
    ...
}

compose.desktop {
    application {
        mainClass = "..."

        nativeDistributions {
            packageVersion = "..."
            packageName = "..."
            version = "..."
            description = "..."
            copyright = "..."
            vendor = ".."
            targetFormats(
                TargetFormat.Dmg,
                TargetFormat.Msi,
                TargetFormat.Deb
            )

            modules(
                // for org.apache.logging.log4j.core.LoggerContext
                "java.management",
                // for DriverManager (required by SQLite JDBC driver)
                "java.sql",
                // for Gson (sun.misc.Unsafe requirement)
                "jdk.unsupported"
            )

            buildTypes.release {
                proguard {
                    configurationFiles.from("<http://___.pro|___.pro>")
                }
            }

            macOS {
                iconFile.set(project.file("icon.icns"))
                bundleID = "..."
            }
            windows {
                iconFile.set(project.file("icon.ico"))
                menuGroup = "..."
                shortcut = true
                // see <https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html>
                upgradeUuid = "B5D7325D-79FC-4814-A24E-2C0E9E09A472"
            }
            linux {
                iconFile.set(project.file("icon.png"))
            }
        }
    }
}
The build must be triggered 3 times on 3 different OS, I rely on my CI setup providing a Linux (Debian/Ubuntu), macOS and Windows build nodes, each of them producing the proper binary by invoking
./gradlew myapp:packageReleaseDistributionForCurrentOS
(or individually each
myapp:packageReleaseDeb
,
myapp:packageReleaseDmg
,
myapp:packageReleaseMsi
depending on the target OS, can't remember, I do not have my CI job in front of my eyes)
n
Thank you this was super helpful! It turns out since I was building/publishing the plugin on a Linux machine on CI it wasn't bundling the necessary macOS dependencies 🙃
👍 1
o
FTR, I was able to check what I do on my CI job and it appears I use
packageReleaseDistributionForCurrentOS
thank you color 1