2022-10-26 13:37:43 +03:00
|
|
|
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 {
|
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")
|
2022-11-17 21:13:51 +03:00
|
|
|
include("*.js")
|
2022-10-26 13:37:43 +03:00
|
|
|
from(jsBrowserDistribution)
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named<JavaExec>("run") {
|
|
|
|
dependsOn(tasks.named<Jar>("jvmJar"))
|
|
|
|
classpath(tasks.named<Jar>("jvmJar"))
|
|
|
|
}
|