[JS_IR] Use new plugin to build Kotlin/JS stdlib with IR compiler
- Switch to building stdlib with bootstrap compiler since IR is stable enough - Build stdlib with coreLibs by default - Include JS IR stdlib to kotlin distribution
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
val commonMainSources by task<Sync> {
|
||||
from(
|
||||
"$rootDir/libraries/kotlin.test/common",
|
||||
"$rootDir/libraries/kotlin.test/annotations-common"
|
||||
)
|
||||
into("$buildDir/commonMainSources")
|
||||
}
|
||||
|
||||
val jsMainSources by task<Sync> {
|
||||
from("$rootDir/libraries/kotlin.test/js/src")
|
||||
into("$buildDir/jsMainSources")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js(IR) {
|
||||
nodejs()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(project(":kotlin-stdlib-js-ir"))
|
||||
}
|
||||
kotlin.srcDir(commonMainSources.get().destinationDir)
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api(project(":kotlin-stdlib-js-ir"))
|
||||
}
|
||||
kotlin.srcDir(jsMainSources.get().destinationDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile<*>>().configureEach {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xallow-result-return-type",
|
||||
"-Xuse-experimental=kotlin.Experimental",
|
||||
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
|
||||
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
|
||||
"-Xinline-classes"
|
||||
)
|
||||
}
|
||||
|
||||
tasks.named("compileKotlinJs") {
|
||||
(this as KotlinCompile<*>).kotlinOptions.freeCompilerArgs += "-Xir-module-name=kotlin-test"
|
||||
dependsOn(commonMainSources)
|
||||
dependsOn(jsMainSources)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user