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

81 lines
2.3 KiB
Plaintext

plugins {
kotlin("multiplatform") version "1.7.10"
kotlin("plugin.serialization") version "1.7.10"
id("org.jetbrains.compose")
application
}
group = "center.sciprog"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport.enabled = true
bundleAnalyzerReportDir = File(buildDir, "analysis")
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-server-netty:2.1.2")
implementation("io.ktor:ktor-server-html-builder-jvm:2.1.2")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
implementation("io.rsocket.kotlin:rsocket-ktor-server:0.15.4")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
implementation(compose.web.core)
implementation("io.ktor:ktor-client-js:2.1.2")
implementation("io.rsocket.kotlin:rsocket-transport-ktor-websocket-client:0.15.4")
}
}
val jsTest by getting
}
}
application {
mainClass.set("center.sciprog.application.ServerKt")
}
tasks.named<Copy>("jvmProcessResources") {
val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
include("*.js")
from(jsBrowserDistribution)
}
tasks.named<JavaExec>("run") {
dependsOn(tasks.named<Jar>("jvmJar"))
classpath(tasks.named<Jar>("jvmJar"))
}