0.14.9 - fix duplicating JS source code publication

This commit is contained in:
Alexander Nozik 2023-05-29 12:58:19 +03:00
parent b05617ce9a
commit 021f78c510
4 changed files with 10 additions and 13 deletions

View File

@ -1,5 +1,5 @@
[versions]
tools = "0.14.8-kotlin-1.8.20"
tools = "0.14.9-kotlin-1.8.20"
kotlin = "1.8.20"
atomicfu = "0.20.2"
binary-compatibility-validator = "0.13.1"

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -13,6 +13,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
@ -208,6 +209,7 @@ public open class KScienceExtension(public val project: Project) {
/**
* Mark this module as an application module. JVM application should be enabled separately
*/
@Deprecated("Use platform-specific applications")
public fun application() {
project.extensions.findByType<KotlinProjectExtension>()?.apply {
explicitApi = null
@ -423,6 +425,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
@OptIn(ExperimentalWasmDsl::class)
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) {
if(project.requestPropertyOrNull("kscience.wasm.disabled") == "true"){
project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
return
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
wasm {
@ -474,8 +481,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
}
jvm {
val processResourcesTaskName =
compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME]
.processResourcesTaskName
compilations[KotlinCompilation.MAIN_COMPILATION_NAME].processResourcesTaskName
val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution")

View File

@ -27,19 +27,10 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
plugins.withId("org.jetbrains.kotlin.js") {
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
kotlin.sourceSets.forEach {
from(it.kotlin)
}
}
publications.create<MavenPublication>("js") {
kotlin.targets.flatMap { it.components }.forEach {
from(it)
}
artifact(sourcesJar)
}
}