KT-54452 Use js-ir sources for building stdlib-js sources.jar and API docs

This commit is contained in:
Ilya Gorbunov
2023-03-14 04:04:35 +01:00
committed by Space Team
parent cd07eba25c
commit 9892a49c4b
3 changed files with 43 additions and 15 deletions
+28
View File
@@ -174,3 +174,31 @@ val packFullRuntimeKLib by tasks.registering(Jar::class) {
archiveFileName.set("full-runtime.klib")
}
val sourcesJar by tasks.registering(Jar::class) {
dependsOn(jsMainSources)
val jsMainSourcesDir = jsMainSources.get().destinationDir
archiveClassifier.set("sources")
includeEmptyDirs = false
duplicatesStrategy = DuplicatesStrategy.FAIL
from("${rootDir}/core/builtins/native/kotlin") {
into("kotlin")
include("Comparable.kt")
include("Enum.kt")
}
from("$jsMainSourcesDir/core/builtins/native") {
exclude("kotlin/Comparable.kt")
}
from("$jsMainSourcesDir/core/builtins/src")
from("$jsMainSourcesDir/libraries/stdlib/js/src")
from("builtins") {
into("kotlin")
exclude("Enum.kt")
}
from("runtime") {
into("runtime")
}
from("src") {
include("**/*.kt")
}
}
+6 -13
View File
@@ -285,22 +285,15 @@ task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
jar.dependsOn(libraryJarWithIr)
task sourcesJar(type: Jar, dependsOn: compileJs) {
dependsOn(":kotlin-stdlib-js-ir:sourcesJar")
archiveClassifier.set('sources')
includeEmptyDirs false
duplicatesStrategy = DuplicatesStrategy.FAIL
from("${builtinsDir}/native/kotlin") {
into 'kotlin'
include 'Comparable.kt'
include 'Enum.kt'
}
from(sourceSets.main.allSource) {
into 'kotlin'
exclude '**/*.java'
exclude 'org.w3c/**'
exclude 'js/**'
}
from(sourceSets.main.allSource) {
include 'org.w3c/**'
from({
def irSources = tasks.getByPath(":kotlin-stdlib-js-ir:sourcesJar")
zipTree(irSources.outputs.files.first().path)
}) {
exclude 'META-INF/*'
}
}
@@ -135,8 +135,15 @@ fun createStdLibVersionedDocTask(version: String, isLatest: Boolean) =
displayName.set("JS")
dependsOn("common")
sourceRoots.from("$kotlin_stdlib_dir/js/src")
sourceRoots.from("$kotlin_stdlib_dir/js-v1/src")
// list src subdirectories except 'generated' as it should be taken from js-ir/src
sourceRoots.from("$kotlin_stdlib_dir/js/src/kotlin")
sourceRoots.from("$kotlin_stdlib_dir/js/src/kotlinx")
sourceRoots.from("$kotlin_stdlib_dir/js/src/org.w3c")
sourceRoots.from("$kotlin_stdlib_dir/js-ir/builtins")
sourceRoots.from("$kotlin_stdlib_dir/js-ir/runtime/kotlinHacks.kt")
sourceRoots.from("$kotlin_stdlib_dir/js-ir/runtime/long.kt")
sourceRoots.from("$kotlin_stdlib_dir/js-ir/src")
perPackageOption("org.w3c") {
reportUndocumented.set(false)