[WASM] Kotlin gradle plugin support Apple ARM for binaryen and D8 extensions
This commit is contained in:
+14
-3
@@ -22,9 +22,20 @@ internal object BinaryenPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const val X64 = "64"
|
const val ARM64 = "arm64"
|
||||||
const val X86 = "86"
|
const val X64 = "x86_64"
|
||||||
|
const val X86 = "x86_86"
|
||||||
|
|
||||||
val architecture: String
|
val architecture: String
|
||||||
get() = if (property("os.arch").contains("64")) X64 else X86
|
get() {
|
||||||
|
val arch = property("os.arch")
|
||||||
|
return when {
|
||||||
|
arch == "aarch64" -> ARM64
|
||||||
|
arch.contains("64") -> X64
|
||||||
|
else -> X86
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val platform: String
|
||||||
|
get() = "$architecture-$name"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -11,7 +11,6 @@ import org.gradle.api.tasks.TaskProvider
|
|||||||
import org.jetbrains.kotlin.gradle.internal.ConfigurationPhaseAware
|
import org.jetbrains.kotlin.gradle.internal.ConfigurationPhaseAware
|
||||||
import org.jetbrains.kotlin.gradle.logging.kotlinInfo
|
import org.jetbrains.kotlin.gradle.logging.kotlinInfo
|
||||||
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
|
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
|
||||||
import java.io.File
|
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
@@ -32,9 +31,7 @@ open class BinaryenRootExtension(@Transient val rootProject: Project) : Configur
|
|||||||
get() = rootProject.tasks.withType(Copy::class.java).named(BinaryenRootPlugin.INSTALL_TASK_NAME)
|
get() = rootProject.tasks.withType(Copy::class.java).named(BinaryenRootPlugin.INSTALL_TASK_NAME)
|
||||||
|
|
||||||
override fun finalizeConfiguration(): BinaryenEnv {
|
override fun finalizeConfiguration(): BinaryenEnv {
|
||||||
val platform = BinaryenPlatform.name
|
val requiredVersionName = "binaryen-version_$version-${BinaryenPlatform.platform}"
|
||||||
val architecture = BinaryenPlatform.architecture
|
|
||||||
val requiredVersionName = "binaryen-version_$version-x86_$architecture-$platform"
|
|
||||||
val requiredZipName = "$requiredVersionName.tar.gz"
|
val requiredZipName = "$requiredVersionName.tar.gz"
|
||||||
val cleanableStore = CleanableStore[installationPath.absolutePath]
|
val cleanableStore = CleanableStore[installationPath.absolutePath]
|
||||||
val targetPath = cleanableStore[requiredVersionName].use()
|
val targetPath = cleanableStore[requiredVersionName].use()
|
||||||
|
|||||||
+28
-11
@@ -11,20 +11,37 @@ internal object D8Platform {
|
|||||||
const val LINUX = "linux"
|
const val LINUX = "linux"
|
||||||
const val DARWIN = "mac"
|
const val DARWIN = "mac"
|
||||||
|
|
||||||
val name: String = run {
|
val name: String
|
||||||
val name = property("os.name").toLowerCase()
|
get() {
|
||||||
when {
|
val osName = property("os.name").toLowerCase()
|
||||||
name.contains("windows") -> WIN
|
return when {
|
||||||
name.contains("mac") -> DARWIN
|
osName.contains("windows") -> WIN
|
||||||
name.contains("linux") -> LINUX
|
osName.contains("mac") -> DARWIN
|
||||||
name.contains("freebsd") -> LINUX
|
osName.contains("linux") -> LINUX
|
||||||
else -> throw IllegalArgumentException("Unsupported OS: $name")
|
osName.contains("freebsd") -> LINUX
|
||||||
|
else -> throw IllegalArgumentException("Unsupported OS: $osName")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
const val ARM64 = "arm64"
|
||||||
const val X64 = "64"
|
const val X64 = "64"
|
||||||
const val X86 = "86"
|
const val X86 = "86"
|
||||||
|
|
||||||
val architecture: String
|
val architecture: String
|
||||||
get() = if (property("os.arch").contains("64")) X64 else X86
|
get() {
|
||||||
}
|
val arch = property("os.arch")
|
||||||
|
return when {
|
||||||
|
arch == "aarch64" -> ARM64
|
||||||
|
arch.contains("64") -> X64
|
||||||
|
else -> X86
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val platform: String
|
||||||
|
get() = when (val architecture = D8Platform.architecture) {
|
||||||
|
ARM64 -> "$name-$ARM64"
|
||||||
|
X64 -> name + X64
|
||||||
|
X86 -> name + X86
|
||||||
|
else -> error("Unexpected platform architecture $architecture")
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-5
@@ -32,11 +32,7 @@ open class D8RootExtension(@Transient val rootProject: Project) : ConfigurationP
|
|||||||
get() = rootProject.tasks.withType(Copy::class.java).named(D8RootPlugin.INSTALL_TASK_NAME)
|
get() = rootProject.tasks.withType(Copy::class.java).named(D8RootPlugin.INSTALL_TASK_NAME)
|
||||||
|
|
||||||
override fun finalizeConfiguration(): D8Env {
|
override fun finalizeConfiguration(): D8Env {
|
||||||
val platform = D8Platform.name
|
val requiredVersionName = "v8-${D8Platform.platform}-$edition-$version"
|
||||||
val architecture = D8Platform.architecture
|
|
||||||
val d8osString = platform + architecture
|
|
||||||
|
|
||||||
val requiredVersionName = "v8-$d8osString-$edition-$version"
|
|
||||||
val requiredZipName = "$requiredVersionName.zip"
|
val requiredZipName = "$requiredVersionName.zip"
|
||||||
val cleanableStore = CleanableStore[installationPath.absolutePath]
|
val cleanableStore = CleanableStore[installationPath.absolutePath]
|
||||||
val targetPath = cleanableStore[requiredVersionName].use()
|
val targetPath = cleanableStore[requiredVersionName].use()
|
||||||
|
|||||||
Reference in New Issue
Block a user