Return source and javadoc publication for kotlin-test-wasm

Setting packaging to klib didn't work because it was overwritten below.

^KTI-692 Fixed
This commit is contained in:
Nikolay Krasko
2021-11-18 16:09:09 +03:00
committed by TeamCityServer
parent 18ed361f9b
commit 6a2c607862
3 changed files with 15 additions and 5 deletions
@@ -103,10 +103,10 @@ var Project.mainPublicationName: String
private fun humanReadableName(name: String) = private fun humanReadableName(name: String) =
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) } name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null) { fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null, packaging: String = "jar") {
val publication = this val publication = this
pom { pom {
packaging = "jar" this.packaging = packaging
name.set(humanReadableName(publication.artifactId)) name.set(humanReadableName(publication.artifactId))
description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId)) description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId))
url.set("https://kotlinlang.org/") url.set("https://kotlinlang.org/")
+3 -2
View File
@@ -368,10 +368,11 @@ publishing {
configureKotlinPomAttributes(project, "Kotlin Test for JS") configureKotlinPomAttributes(project, "Kotlin Test for JS")
} }
create("wasm", MavenPublication::class) { create("wasm", MavenPublication::class) {
pom.packaging = "klib"
artifactId = "kotlin-test-wasm" artifactId = "kotlin-test-wasm"
from(wasmComponent) from(wasmComponent)
configureKotlinPomAttributes(project, "Kotlin Test for WASM") artifact(tasks.getByPath(":kotlin-test:kotlin-test-wasm:sourcesJar") as Jar)
artifact(emptyJavadocJar)
configureKotlinPomAttributes(project, "Kotlin Test for WASM", packaging = "klib")
} }
create("common", MavenPublication::class) { create("common", MavenPublication::class) {
artifactId = "kotlin-test-common" artifactId = "kotlin-test-common"
+10 -1
View File
@@ -17,13 +17,15 @@ kotlin {
nodejs() nodejs()
} }
@Suppress("UNUSED_VARIABLE")
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(project(":kotlin-stdlib-wasm")) api(project(":kotlin-stdlib-wasm"))
} }
kotlin.srcDir(commonMainSources.get().destinationDir) kotlin.srcDir(commonMainSources.get().destinationDir)
} }
val wasmMain by getting { val wasmMain by getting {
dependencies { dependencies {
api(project(":kotlin-stdlib-wasm")) api(project(":kotlin-stdlib-wasm"))
@@ -45,3 +47,10 @@ tasks.named("compileKotlinWasm") {
(this as KotlinCompile<*>).kotlinOptions.freeCompilerArgs += "-Xir-module-name=kotlin-test" (this as KotlinCompile<*>).kotlinOptions.freeCompilerArgs += "-Xir-module-name=kotlin-test"
dependsOn(commonMainSources) dependsOn(commonMainSources)
} }
tasks.register<Jar>("sourcesJar") {
dependsOn(commonMainSources)
archiveClassifier.set("sources")
from(kotlin.sourceSets["commonMain"].kotlin)
from(kotlin.sourceSets["wasmMain"].kotlin)
}