Fix publishing for js

This commit is contained in:
Alexander Nozik 2021-06-04 18:50:20 +03:00
parent 24af07eb7b
commit 329bfa5881
2 changed files with 14 additions and 6 deletions

View File

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

View File

@ -21,16 +21,20 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
configure<PublishingExtension> {
plugins.withId("org.jetbrains.kotlin.js") {
val kotlin = extensions.findByType<KotlinJsProjectExtension>()!!
val kotlin: KotlinJsProjectExtension = extensions.findByType<KotlinJsProjectExtension>()!!
val sourcesJar: Jar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(kotlin.sourceSets["main"].kotlin)
kotlin.sourceSets.forEach{
from(it.kotlin)
}
}
publications {
create("js", MavenPublication::class) {
from(components["kotlin"])
kotlin.js().components.forEach {
from(it)
}
artifact(sourcesJar)
}
}
@ -41,12 +45,16 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
val sourcesJar: Jar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(kotlin.sourceSets["main"].kotlin)
kotlin.sourceSets.forEach{
from(it.kotlin)
}
}
publications {
create("jvm", MavenPublication::class) {
from(components["kotlin"])
kotlin.target.components.forEach {
from(it)
}
artifact(sourcesJar)
}
}