kotlin-full-stack-demo/build.gradle.kts

84 lines
2.0 KiB
Plaintext

plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.compose)
alias(libs.plugins.ktor)
application
}
group = "center.sciprog"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
google()
}
kotlin {
jvmToolchain(17)
jvm {
withJava()
testRuns.configureEach {
executionTask {
useJUnitPlatform()
}
}
}
js(IR) {
useEsModules()
browser {
commonWebpackConfig {
cssSupport {
enabled = true
}
}
}
binaries.executable()
}
sourceSets {
commonMain {
dependencies {
implementation(compose.runtime)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
}
}
commonTest {
dependencies {
implementation(libs.kotlin.test)
}
}
jvmMain {
dependencies {
implementation(libs.ktor.server.netty)
implementation(libs.ktor.server.html.builder)
implementation(libs.rsocket.ktor.server)
implementation(libs.logback.classic)
}
}
jsMain {
dependencies {
implementation(compose.html.core)
implementation(libs.ktor.client.js)
implementation(libs.rsocket.transport.ktor.websocket.client)
}
}
}
}
application {
mainClass.set("fullstack.kotlin.demo.ServerKt")
}
tasks.named<Copy>("jvmProcessResources") {
val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
dependsOn(jsBrowserDistribution)
from(jsBrowserDistribution) {
into("www")
}
}
tasks.named<JavaExec>("run") {
dependsOn(tasks.named<Jar>("jvmJar"))
classpath(tasks.named<Jar>("jvmJar"))
}