Adjust js distribution name and move task to configuraition time.

This commit is contained in:
Alexander Nozik 2019-12-30 17:02:12 +03:00
parent 99fdcfe60d
commit e00642bb34
3 changed files with 19 additions and 17 deletions

View File

@ -7,7 +7,7 @@ plugins {
} }
group = "scientifik" group = "scientifik"
version = "0.3.1" version = "0.3.2"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()

View File

@ -45,11 +45,12 @@ open class ScientifikJSPlugin : Plugin<Project> {
outputFileName = "main.bundle.js" outputFileName = "main.bundle.js"
} }
afterEvaluate {
val installJsDist by creating(Copy::class) { val installJsDist by creating(Copy::class) {
group = "distribution" group = "distribution"
dependsOn(browserWebpack) dependsOn(browserWebpack)
from(fileTree("src/main/web")) from(fileTree("src/main/web"))
afterEvaluate {
into(browserWebpack.destinationDirectory!!) into(browserWebpack.destinationDirectory!!)
doLast { doLast {
val indexFile = File(browserWebpack.destinationDirectory!!, "index.html") val indexFile = File(browserWebpack.destinationDirectory!!, "index.html")
@ -58,10 +59,10 @@ open class ScientifikJSPlugin : Plugin<Project> {
} }
} }
} }
findByName("assemble")?.dependsOn(installJsDist)
} }
findByName("assemble")?.dependsOn(installJsDist)
} }
} }

View File

@ -115,17 +115,18 @@ open class ScientifikMPPlugin : Plugin<Project> {
tasks.apply { tasks.apply {
val jsBrowserWebpack by getting(KotlinWebpack::class) { val jsBrowserWebpack by getting(KotlinWebpack::class) {
afterEvaluate { afterEvaluate {
val destination = listOf(name, version.toString()).joinToString("-") val destination = listOf(name, "js", version.toString()).joinToString("-")
destinationDirectory = destinationDirectory?.resolve(destination) destinationDirectory = destinationDirectory?.resolve(destination)
} }
outputFileName = "main.bundle.js" outputFileName = "main.bundle.js"
} }
afterEvaluate {
val installJsDist by creating(Copy::class) { val installJsDist by creating(Copy::class) {
group = "distribution" group = "distribution"
dependsOn(jsBrowserWebpack) dependsOn(jsBrowserWebpack)
from(project.fileTree("src/jsMain/web")) from(project.fileTree("src/jsMain/web"))
afterEvaluate {
into(jsBrowserWebpack.destinationDirectory!!) into(jsBrowserWebpack.destinationDirectory!!)
doLast { doLast {
val indexFile = File(jsBrowserWebpack.destinationDirectory!!, "index.html") val indexFile = File(jsBrowserWebpack.destinationDirectory!!, "index.html")
@ -134,10 +135,10 @@ open class ScientifikMPPlugin : Plugin<Project> {
} }
} }
} }
findByName("assemble")?.dependsOn(installJsDist)
} }
findByName("assemble")?.dependsOn(installJsDist)
// withType<Test>(){ // withType<Test>(){
// useJUnitPlatform() // useJUnitPlatform()
// } // }