Skip to content

Commit

Permalink
Improve the code used to add awt-runtime dependency
Browse files Browse the repository at this point in the history
Co-authored-by: merati22 <[email protected]>
Co-authored-by: Mahdi Hosseinzadeh <[email protected]>
  • Loading branch information
mahozad and Merati22 committed Jul 18, 2024
1 parent f625e97 commit 393c003
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,22 @@ kotlin {
val desktopMain by getting {
dependencies {
// api(libs.androidx.ui.desktop)
// See https://github.com/JetBrains/compose-multiplatform/blob/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/osUtils.kt
val osName = System.getProperty("os.name")
val osArch = System.getProperty("os.arch")
val targetOs = when {
osName == "Mac OS X" -> "macos"
osName.startsWith("Win") -> "windows"
osName.startsWith("Linux") -> "linux"
osName.equals("Mac OS X", ignoreCase = true) -> "macos"
osName.startsWith("Win", ignoreCase = true) -> "windows"
osName.startsWith("Linux", ignoreCase = true) -> "linux"
else -> error("Unsupported OS: $osName")
}

val osArch = System.getProperty("os.arch")
val targetArch = when (osArch) {
"x86_64", "amd64" -> "x64"
"aarch64" -> "arm64"
else -> error("Unsupported arch: $osArch")
else -> error("Unsupported architecture: $osArch")
}

val version = "0.8.9" // or any more recent version
val target = "${targetOs}-${targetArch}"
val version = libs.versions.skiko.get()
implementation("org.jetbrains.skiko:skiko-awt-runtime-$target:$version")
}
}
Expand Down

0 comments on commit 393c003

Please sign in to comment.