From 670a4ca71ee0a9b714eaef63fa7582ad478fedf9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 4 Jun 2021 19:02:25 +0300 Subject: [PATCH] Fix publishing for js --- .../ru/mipt/npm/gradle/internal/publishing.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt index 59d7de4..94eccc8 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt @@ -21,7 +21,7 @@ internal fun Project.setupPublication(vcs: String) = allprojects { configure { plugins.withId("org.jetbrains.kotlin.js") { - val kotlin: KotlinJsProjectExtension = extensions.findByType()!! + val kotlin: KotlinJsProjectExtension = extensions.findByType()!! val sourcesJar: Jar by tasks.creating(Jar::class) { archiveClassifier.set("sources") @@ -29,13 +29,14 @@ internal fun Project.setupPublication(vcs: String) = allprojects { from(it.kotlin) } } - - publications { - create("js", MavenPublication::class) { - kotlin.js().components.forEach { - from(it) + afterEvaluate { + publications { + create("js", MavenPublication::class) { + kotlin.js().components.forEach { + from(it) + } + artifact(sourcesJar) } - artifact(sourcesJar) } } }