97 lines
2.7 KiB
Kotlin
Vendored
97 lines
2.7 KiB
Kotlin
Vendored
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
|
|
|
|
plugins {
|
|
kotlin("multiplatform") version "KOTLIN_VERSION"
|
|
application
|
|
}
|
|
|
|
group = "me.user"
|
|
version = "1.0-SNAPSHOT"
|
|
|
|
repositories {
|
|
jcenter()
|
|
mavenCentral()
|
|
maven { url = uri("https://dl.bintray.com/kotlin/kotlin-js-wrappers") }
|
|
maven { url = uri("https://dl.bintray.com/kotlin/kotlinx") }
|
|
maven { url = uri("https://dl.bintray.com/kotlin/ktor") }
|
|
}
|
|
|
|
kotlin {
|
|
jvm {
|
|
compilations.all {
|
|
kotlinOptions.jvmTarget = "1.8"
|
|
}
|
|
testRuns["test"].executionTask.configure {
|
|
useJUnit()
|
|
}
|
|
withJava()
|
|
}
|
|
js(LEGACY) {
|
|
browser {
|
|
binaries.executable()
|
|
webpackTask {
|
|
cssSupport.enabled = true
|
|
}
|
|
runTask {
|
|
cssSupport.enabled = true
|
|
}
|
|
testTask {
|
|
useKarma {
|
|
useChromeHeadless()
|
|
webpackConfig.cssSupport.enabled = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
sourceSets {
|
|
val commonMain by getting
|
|
val commonTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-common"))
|
|
implementation(kotlin("test-annotations-common"))
|
|
}
|
|
}
|
|
val jvmMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-server-netty:1.4.0")
|
|
implementation("io.ktor:ktor-html-builder:1.4.0")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
|
|
}
|
|
}
|
|
val jvmTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-junit"))
|
|
}
|
|
}
|
|
val jsMain by getting {
|
|
dependencies {
|
|
implementation("org.jetbrains:kotlin-react:16.13.1-pre.113-kotlin-1.4.0")
|
|
implementation("org.jetbrains:kotlin-react-dom:16.13.1-pre.113-kotlin-1.4.0")
|
|
}
|
|
}
|
|
val jsTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-js"))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
application {
|
|
mainClassName = "ServerKt"
|
|
}
|
|
|
|
tasks.getByName<KotlinWebpack>("jsBrowserProductionWebpack") {
|
|
outputFileName = "output.js"
|
|
}
|
|
|
|
tasks.getByName<Jar>("jvmJar") {
|
|
dependsOn(tasks.getByName("jsBrowserProductionWebpack"))
|
|
val jsBrowserProductionWebpack = tasks.getByName<KotlinWebpack>("jsBrowserProductionWebpack")
|
|
from(File(jsBrowserProductionWebpack.destinationDirectory, jsBrowserProductionWebpack.outputFileName))
|
|
}
|
|
|
|
tasks.getByName<JavaExec>("run") {
|
|
dependsOn(tasks.getByName<Jar>("jvmJar"))
|
|
classpath(tasks.getByName<Jar>("jvmJar"))
|
|
} |