Automatic link generation for JS distribution

This commit is contained in:
Alexander Nozik 2019-07-27 18:45:42 +03:00
parent 37b2f0bc1f
commit 3ae239cafb
2 changed files with 11 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* Build constants * Build constants
*/ */
object Scientifik { object Scientifik {
const val ioVersion = "0.1.11" const val ioVersion = "0.1.13"
const val coroutinesVersion = "1.2.2" const val coroutinesVersion = "1.2.2"
const val atomicfuVersion = "0.12.9" const val atomicfuVersion = "0.12.9"
const val serializationVersion = "0.11.1" const val serializationVersion = "0.11.1"

View File

@ -38,7 +38,7 @@ open class ScientifikMPPlugin : Plugin<Project> {
api(kotlin("stdlib")) api(kotlin("stdlib"))
project.afterEvaluate { project.afterEvaluate {
if (extension.serialization) { if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}") implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${Scientifik.serializationVersion}")
} }
if(extension.io){ if(extension.io){
api("org.jetbrains.kotlinx:kotlinx-io:${Scientifik.ioVersion}") api("org.jetbrains.kotlinx:kotlinx-io:${Scientifik.ioVersion}")
@ -56,6 +56,10 @@ open class ScientifikMPPlugin : Plugin<Project> {
dependencies { dependencies {
api(kotlin("stdlib-jdk8")) api(kotlin("stdlib-jdk8"))
project.afterEvaluate { project.afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.io) { if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}") api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
} }
@ -72,6 +76,10 @@ open class ScientifikMPPlugin : Plugin<Project> {
dependencies { dependencies {
api(kotlin("stdlib-js")) api(kotlin("stdlib-js"))
project.afterEvaluate { project.afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Scientifik.serializationVersion}")
}
if (extension.io) { if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}") api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
} }
@ -111,7 +119,7 @@ open class ScientifikMPPlugin : Plugin<Project> {
from(project.fileTree("src/jsMain/web")) from(project.fileTree("src/jsMain/web"))
into(jsBrowserWebpack.destinationDirectory!!) into(jsBrowserWebpack.destinationDirectory!!)
doLast{ doLast{
val indexFile = File(browserWebpack.destinationDirectory!!,"index.html") val indexFile = File(jsBrowserWebpack.destinationDirectory!!,"index.html")
if(indexFile.exists()){ if(indexFile.exists()){
println("Run JS distribution at: ${indexFile.canonicalPath}") println("Run JS distribution at: ${indexFile.canonicalPath}")
} }