[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:
Svyatoslav Kuzmich
2020-03-12 16:16:24 +03:00
parent 14edc26cf1
commit 3d5003d476
26 changed files with 378 additions and 346 deletions
+37
View File
@@ -0,0 +1,37 @@
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"
}
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:kotlin.wasm.internal.ExcludedFromCodegen
package kotlin.ranges
// Stubs for unimplemented classes used by CommonBackendContext
class CharProgression
class IntProgression
class LongProgression
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -1,9 +0,0 @@
@file:kotlin.wasm.internal.ExcludedFromCodegen
package kotlin.ranges
// Stubs for unimplemented classes used by CommonBackendContext
class CharProgression
class IntProgression
class LongProgression