| import org.jetbrains.kotlin.gradle.dsl.KotlinCompile |
| import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.IR |
| import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension |
| import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin |
| |
| plugins { |
| kotlin("multiplatform") |
| } |
| |
| kotlin { |
| js(IR) { |
| nodejs() |
| } |
| sourceSets { |
| val jsMain by getting { |
| kotlin.srcDirs("builtins", "internal", "runtime") |
| } |
| } |
| } |
| |
| 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", |
| "-Xopt-in=kotlin.RequiresOptIn", |
| "-Xopt-in=kotlin.ExperimentalUnsignedTypes", |
| "-Xopt-in=kotlin.ExperimentalStdlibApi" |
| ) |
| } |
| |
| tasks.named("compileKotlinJs") { |
| (this as KotlinCompile<*>).kotlinOptions.freeCompilerArgs += "-Xir-module-name=kotlin" |
| } |