From e00642bb34a7091a1febb73fb3e90294d1aef935 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 30 Dec 2019 17:02:12 +0300 Subject: [PATCH] Adjust js distribution name and move task to configuraition time. --- build.gradle.kts | 2 +- .../kotlin/scientifik/ScientifikJSPlugin.kt | 17 +++++++++-------- .../kotlin/scientifik/ScientifikMPPlugin.kt | 17 +++++++++-------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 598002d..6d4ffce 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "scientifik" -version = "0.3.1" +version = "0.3.2" repositories { gradlePluginPortal() diff --git a/src/main/kotlin/scientifik/ScientifikJSPlugin.kt b/src/main/kotlin/scientifik/ScientifikJSPlugin.kt index 9475f4d..14b262e 100644 --- a/src/main/kotlin/scientifik/ScientifikJSPlugin.kt +++ b/src/main/kotlin/scientifik/ScientifikJSPlugin.kt @@ -45,11 +45,12 @@ open class ScientifikJSPlugin : Plugin { outputFileName = "main.bundle.js" } - afterEvaluate { - val installJsDist by creating(Copy::class) { - group = "distribution" - dependsOn(browserWebpack) - from(fileTree("src/main/web")) + + val installJsDist by creating(Copy::class) { + group = "distribution" + dependsOn(browserWebpack) + from(fileTree("src/main/web")) + afterEvaluate { into(browserWebpack.destinationDirectory!!) doLast { val indexFile = File(browserWebpack.destinationDirectory!!, "index.html") @@ -58,10 +59,10 @@ open class ScientifikJSPlugin : Plugin { } } } - - findByName("assemble")?.dependsOn(installJsDist) - } + + findByName("assemble")?.dependsOn(installJsDist) + } } diff --git a/src/main/kotlin/scientifik/ScientifikMPPlugin.kt b/src/main/kotlin/scientifik/ScientifikMPPlugin.kt index 6e5680c..ca92f4f 100644 --- a/src/main/kotlin/scientifik/ScientifikMPPlugin.kt +++ b/src/main/kotlin/scientifik/ScientifikMPPlugin.kt @@ -115,17 +115,18 @@ open class ScientifikMPPlugin : Plugin { tasks.apply { val jsBrowserWebpack by getting(KotlinWebpack::class) { afterEvaluate { - val destination = listOf(name, version.toString()).joinToString("-") + val destination = listOf(name, "js", version.toString()).joinToString("-") destinationDirectory = destinationDirectory?.resolve(destination) } outputFileName = "main.bundle.js" } - afterEvaluate { - val installJsDist by creating(Copy::class) { - group = "distribution" - dependsOn(jsBrowserWebpack) - from(project.fileTree("src/jsMain/web")) + + val installJsDist by creating(Copy::class) { + group = "distribution" + dependsOn(jsBrowserWebpack) + from(project.fileTree("src/jsMain/web")) + afterEvaluate { into(jsBrowserWebpack.destinationDirectory!!) doLast { val indexFile = File(jsBrowserWebpack.destinationDirectory!!, "index.html") @@ -134,10 +135,10 @@ open class ScientifikMPPlugin : Plugin { } } } - - findByName("assemble")?.dependsOn(installJsDist) } + findByName("assemble")?.dependsOn(installJsDist) + // withType(){ // useJUnitPlatform() // }