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

84 lines
2.0 KiB
Plaintext
Raw Normal View History

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