Unverified Commit 1ef83d20 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Distinct name for platform artifacts. (#29)

parent f7519166
...@@ -346,7 +346,7 @@ extensions.configure<CppLibrary> { ...@@ -346,7 +346,7 @@ extensions.configure<CppLibrary> {
library { library {
linkage.addAll(listOf(Linkage.SHARED)) linkage.addAll(listOf(Linkage.SHARED))
targetMachines.addAll(listOf(machines.macOS.x86_64, machines.linux.x86_64, machines.windows.x86_64)) targetMachines.addAll(listOf(machines.macOS.x86_64, machines.linux.x86_64, machines.windows.x86_64))
baseName.set("skiko") baseName.set("skiko-$target")
dependencies { dependencies {
implementation( implementation(
......
...@@ -35,7 +35,7 @@ object Library { ...@@ -35,7 +35,7 @@ object Library {
if (loaded) return if (loaded) return
val resourcePath = "/" val resourcePath = "/"
val name = "skiko" val name = "skiko-$hostId"
val platformName = System.mapLibraryName(name) val platformName = System.mapLibraryName(name)
val hash = Library::class.java.getResourceAsStream("$resourcePath$platformName.sha256").use { val hash = Library::class.java.getResourceAsStream("$resourcePath$platformName.sha256").use {
...@@ -44,7 +44,7 @@ object Library { ...@@ -44,7 +44,7 @@ object Library {
val cacheDir = File("$cacheRoot/$hash") val cacheDir = File("$cacheRoot/$hash")
cacheDir.mkdirs() cacheDir.mkdirs()
loadOrGet(cacheDir, resourcePath, platformName, true) loadOrGet(cacheDir, resourcePath, platformName, true)
val loadIcu = OSType.currentOs == OSType.WINDOWS val loadIcu = hostOs.isWindows
if (loadIcu) { if (loadIcu) {
loadOrGet(cacheDir, resourcePath, "icudtl.dat", false) loadOrGet(cacheDir, resourcePath, "icudtl.dat", false)
} }
......
package org.jetbrains.skiko
enum class OSType {
MAC_OS, LINUX, WINDOWS, UNKNOWN;
companion object {
val currentOs by lazy {
val name = System.getProperty("os.name").toLowerCase()
when {
name.indexOf("win") >= 0 -> WINDOWS
name.indexOf("mac") >= 0 -> MAC_OS
name.indexOf("linux") >= 0 -> LINUX
else -> UNKNOWN
}
}
}
}
\ No newline at end of file
package org.jetbrains.skiko
enum class OS(val id: String) {
Linux("linux"),
Windows("windows"),
MacOS("macos")
;
val isWindows
get() = this == Windows
}
enum class Arch(val id: String) {
X64("x64"),
Arm64("arm64")
}
val hostOs by lazy {
val osName = System.getProperty("os.name")
when {
osName == "Mac OS X" -> OS.MacOS
osName == "Linux" -> OS.Linux
osName.startsWith("Win") -> OS.Windows
else -> throw Error("Unknown OS $osName")
}
}
val hostArch by lazy {
val osArch = System.getProperty("os.arch")
when (osArch) {
"x86_64", "amd64" -> Arch.X64
"aarch64" -> Arch.Arm64
else -> throw Error("Unknown arch $osArch")
}
}
val hostId by lazy {
"${hostOs.id}-${hostArch.id}"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment