[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:
@@ -7,6 +7,7 @@ configurePublishing(project)
|
||||
configurations {
|
||||
sources
|
||||
distJs
|
||||
distLibrary
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -19,7 +20,6 @@ compileKotlin2Js {
|
||||
kotlinOptions.freeCompilerArgs = [
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
|
||||
"-Xir-produce-klib-dir"
|
||||
]
|
||||
kotlinOptions {
|
||||
moduleKind = "umd"
|
||||
@@ -42,15 +42,39 @@ compileTestKotlin2Js {
|
||||
archivesBaseName = 'kotlin-test-js'
|
||||
|
||||
jar {
|
||||
enabled false
|
||||
}
|
||||
|
||||
task libraryJarWithoutIr(type: Jar, dependsOn: compileKotlin2Js) {
|
||||
classifier = null
|
||||
destinationDirectory = file("$buildDir/lib/dist")
|
||||
from("$buildDir/classes/main")
|
||||
manifestAttributes(manifest, project, 'Test')
|
||||
}
|
||||
|
||||
task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
|
||||
archiveExtension = "jar"
|
||||
destinationDirectory = file("$buildDir/libs")
|
||||
|
||||
duplicatesStrategy DuplicatesStrategy.FAIL
|
||||
|
||||
from zipTree(libraryJarWithoutIr.archiveFile)
|
||||
if (rootProject.includeStdlibJsIr) {
|
||||
def irKlib = tasks.getByPath(":kotlin-stdlib-js-ir:generateKotlinTestKLib")
|
||||
dependsOn(irKlib)
|
||||
from fileTree("${irKlib.outputs.files.singleFile.path}/klib")
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from (sourceSets.main.allSource)
|
||||
}
|
||||
|
||||
artifacts {
|
||||
runtime libraryJarWithoutIr
|
||||
archives libraryJarWithIr
|
||||
distLibrary libraryJarWithoutIr
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
||||
|
||||
@@ -32,7 +32,11 @@ task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
|
||||
|
||||
from {
|
||||
configurations.nodeModules.collect {
|
||||
zipTree(it.absolutePath).matching { include '*.js' }
|
||||
// WORKAROUND: Some JS IR jars were absent and caused this task to fail.
|
||||
// They don't contain .js thus we can skip them.
|
||||
if (it.exists()) {
|
||||
zipTree(it.absolutePath).matching { include '*.js' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user