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("fullstack.kotlin.demo.ServerKt") } tasks.named("jvmProcessResources") { val jsBrowserDistribution = tasks.named("jsBrowserDistribution") include("*.js") from(jsBrowserDistribution) } tasks.named("run") { dependsOn(tasks.named("jvmJar")) classpath(tasks.named("jvmJar")) }