[Wasm] Add wasi stdlib target gradle buildscript

KT-56608
This commit is contained in:
Igor Yakovlev
2023-07-31 14:51:56 +02:00
committed by Zalim Bashorov
parent 18a9c1916e
commit d1c7caf15c
14 changed files with 328 additions and 226 deletions
+47
View File
@@ -0,0 +1,47 @@
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
import org.jetbrains.kotlin.gradle.targets.js.KotlinWasmTargetAttribute
plugins {
`maven-publish`
kotlin("multiplatform")
}
description = "Kotlin Standard Library for experimental WebAssembly JS platform"
D8RootPlugin.apply(rootProject).version = v8Version
val targetDependentSources = listOf("builtins/kotlin", "internal", "src/kotlin", "src/kotlinx", "src/org.w3c").map {
"$rootDir/libraries/stdlib/wasm/js/$it"
}
configureWasmStdLib(
wasmTargetParameter = "wasm-js",
wasmTargetAttribute = KotlinWasmTargetAttribute.js,
targetDependentSources = targetDependentSources,
targetDependentTestSources = listOf("$rootDir/libraries/stdlib/wasm/testJs/"),
kotlinTestDependencyName = ":kotlin-test:kotlin-test-wasm-js"
) { extensionBody ->
kotlin(extensionBody)
}
afterEvaluate {
// cleanup default publications
// TODO: remove after mpp plugin allows avoiding their creation at all, KT-29273
publishing {
publications.removeAll { it.name != "Main" }
}
tasks.withType<AbstractPublishToMaven> {
if (publication.name != "Main") this.enabled = false
}
tasks.named("publish") {
doFirst {
publishing.publications {
if (singleOrNull()?.name != "Main") {
throw GradleException("kotlin-stdlib-wasm should have only one publication, found $size: ${joinToString { it.name }}")
}
}
}
}
}