Andromadus Naruto
02/27/2022, 8:00 AMval ktorVersion = "1.6.7"
val serializationVersion = "1.3.2"
plugins {
kotlin("multiplatform") version "1.6.10"
kotlin("plugin.serialization") version "1.6.10"
application
}
group = "me.andromadus"
version = "1.0-SNAPSHOT"
repositories {
jcenter()
mavenCentral()
maven("<https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven>")
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(LEGACY) {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
implementation("io.ktor:ktor-client-core:$ktorVersion")
}
}
val commonTest by getting
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-serialization:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-html-builder:$ktorVersion")
implementation("ch.qos.logback:logback-classic:1.2.10")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:17.0.2-pre.240-kotlin-1.5.30")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:17.0.2-pre.240-kotlin-1.5.30")
implementation("io.ktor:ktor-client-js:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
}
}
val jsTest by getting
}
}
application {
mainClass.set("me.andromadus.application.ServerKt")
}
tasks.named<Copy>("jvmProcessResources") {
val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
from(jsBrowserDistribution)
}
tasks.named<JavaExec>("run") {
dependsOn(tasks.named<Jar>("jvmJar"))
classpath(tasks.named<Jar>("jvmJar"))
}