Automatic link generation for JS distribution

This commit is contained in:
Alexander Nozik 2019-07-27 12:48:32 +03:00
parent e0ec9a20d7
commit 37b2f0bc1f
2 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
import java.io.File
open class ScientifikJSPlugin : Plugin<Project> {
override fun apply(project: Project) {
@ -58,6 +59,12 @@ open class ScientifikJSPlugin : Plugin<Project> {
dependsOn(browserWebpack)
from(fileTree("src/main/web"))
into(browserWebpack.destinationDirectory!!)
doLast{
val indexFile = File(browserWebpack.destinationDirectory!!,"index.html")
if(indexFile.exists()){
println("Run JS distribution at: ${indexFile.canonicalPath}")
}
}
}
findByName("assemble")?.dependsOn(installJsDist)

View File

@ -7,6 +7,7 @@ import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
import java.io.File
open class ScientifikMPPlugin : Plugin<Project> {
override fun apply(project: Project) {
@ -109,6 +110,12 @@ open class ScientifikMPPlugin : Plugin<Project> {
dependsOn(jsBrowserWebpack)
from(project.fileTree("src/jsMain/web"))
into(jsBrowserWebpack.destinationDirectory!!)
doLast{
val indexFile = File(browserWebpack.destinationDirectory!!,"index.html")
if(indexFile.exists()){
println("Run JS distribution at: ${indexFile.canonicalPath}")
}
}
}
findByName("assemble")?.dependsOn(installJsDist)