[JS IR] Build stdlib using compiler from repo

Previously JS IR versions of stdlib and kotlin-test were build
by default using compiler previously built on a buildserver.

It had some issues:
 - This required us to advance bootstrap every time we made any
   incompatible IR changes. This happens often since IR ABI is
   not quite stable yet.

 - We never tested the exact combination of compiler and stdlib we publish

   We tested:
    - new compiler with new stdlib build by new compiler (in box tests)
    - old compiler with new stdlib build by old compiler (in stdlib tests)

   We published:
    - new compiler with new stdlib build by old compiler

After this change JS IR compiler tests, builds and publishes
single configuration:

    new compiler with new stdlib build by new compiler

JS IR stdlib and kotlin-test are now built using JavaExec of CLI instead
of Gradle plugin to avoid troubles of loading a freshly built plugin.

This also allows to have a granular dependencies: we don't rebuild klib
if we changed a lowering in a compiler backend, but we do rebuild it if
we changed IR serialization algorithm.
This commit is contained in:
Svyatoslav Kuzmich
2019-11-18 20:17:21 +03:00
parent 70111f8db1
commit 31c84e9ac4
20 changed files with 439 additions and 420 deletions
+15 -5
View File
@@ -30,12 +30,13 @@ dependencies {
testCompileOnly(project(":compiler:frontend"))
testCompileOnly(project(":compiler:cli"))
testCompileOnly(project(":compiler:cli-js"))
testCompileOnly(project(":compiler:cli-js-klib"))
testCompileOnly(project(":compiler:util"))
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "util") }
testCompile(project(":compiler:backend.js"))
testCompile(project(":compiler:backend.wasm"))
testCompile(projectTests(":compiler:ir.serialization.js"))
testCompile(project(":kotlin-stdlib-js-ir"))
testCompile(project(":js:js.translator"))
testCompile(project(":js:js.serializer"))
testCompile(project(":js:js.dce"))
@@ -44,6 +45,15 @@ dependencies {
testCompile(projectTests(":kotlin-build-common"))
testCompile(projectTests(":generators:test-generator"))
testCompile(intellijCoreDep()) { includeJars("intellij-core") }
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:util"))
testRuntime(project(":kotlin-reflect"))
testRuntime(intellijDep()) { includeJars("picocontainer", "trove4j", "guava", "jdom", rootProject = rootProject) }
val currentOs = OperatingSystem.current()
val j2v8idString = when {
@@ -85,9 +95,9 @@ fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
dependsOn(":dist")
if (jsEnabled) dependsOn(testJsRuntime)
if (jsIrEnabled) {
dependsOn(":compiler:ir.serialization.js:generateFullRuntimeKLib")
dependsOn(":compiler:ir.serialization.js:generateReducedRuntimeKLib")
dependsOn(":compiler:ir.serialization.js:generateKotlinTestKLib")
dependsOn(":kotlin-stdlib-js-ir:generateFullRuntimeKLib")
dependsOn(":kotlin-stdlib-js-ir:generateReducedRuntimeKLib")
dependsOn(":kotlin-stdlib-js-ir:generateKotlinTestKLib")
}
exclude("org/jetbrains/kotlin/js/test/wasm/semantics/*")
@@ -207,7 +217,7 @@ val unzipJsShell by task<Copy> {
projectTest("wasmTest", true) {
dependsOn(unzipJsShell)
dependsOn(":compiler:ir.serialization.js:generateWasmRuntimeKLib")
dependsOn(":kotlin-stdlib-js-ir:generateWasmRuntimeKLib")
include("org/jetbrains/kotlin/js/test/wasm/semantics/*")
val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath
systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath)
@@ -23,9 +23,9 @@ import org.jetbrains.kotlin.utils.fileUtils.withReplacedExtensionOrNull
import java.io.File
import java.lang.Boolean.getBoolean
private val fullRuntimeKlib = "compiler/ir/serialization.js/build/fullRuntime/klib"
private val defaultRuntimeKlib = "compiler/ir/serialization.js/build/reducedRuntime/klib"
private val kotlinTestKLib = "compiler/ir/serialization.js/build/kotlin.test/klib"
private val fullRuntimeKlib = "libraries/stdlib/js-ir/build/fullRuntime/klib"
private val defaultRuntimeKlib = "libraries/stdlib/js-ir/build/reducedRuntime/klib"
private val kotlinTestKLib = "libraries/stdlib/js-ir/build/kotlin.test/klib"
abstract class BasicIrBoxTest(
pathToTestDir: String,
@@ -35,7 +35,7 @@ import java.io.File
import java.lang.Boolean.getBoolean
private val wasmRuntimeKlib =
loadKlib("compiler/ir/serialization.js/build/wasmRuntime/klib")
loadKlib("libraries/stdlib/js-ir/build/wasmRuntime/klib")
abstract class BasicWasmBoxTest(
private val pathToTestDir: String,