Files
2021-03-01 11:19:23 +01:00

98 lines
2.5 KiB
Groovy
Vendored

import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
plugins {
id 'org.jetbrains.kotlin.multiplatform' version 'KOTLIN_VERSION'
id 'application'
}
group = 'me.user'
version = '1.0-SNAPSHOT'
repositories {
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/kotlin-js-wrappers' }
maven { url 'https://dl.bintray.com/kotlin/kotlinx' }
}
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 {
commonMain {
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation 'io.ktor:ktor-server-netty:1.5.2'
implementation 'io.ktor:ktor-html-builder:1.5.2'
implementation 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2'
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
}
}
jsMain {
dependencies {
implementation 'org.jetbrains:kotlin-react:17.0.1-pre.148-kotlin-1.4.30'
implementation 'org.jetbrains:kotlin-react-dom:17.0.1-pre.148-kotlin-1.4.30'
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
}
}
application {
mainClassName = 'ServerKt'
}
tasks.getByName('jsBrowserProductionWebpack') {
outputFileName = 'output.js'
}
tasks.getByName('jvmJar') {
dependsOn(tasks.getByName('jsBrowserProductionWebpack'))
def jsBrowserProductionWebpack = tasks.getByName('jsBrowserProductionWebpack')
from(new File(jsBrowserProductionWebpack.destinationDirectory, jsBrowserProductionWebpack.outputFileName))
}
tasks.getByName('run') {
dependsOn(tasks.getByName('jvmJar'))
classpath(tasks.getByName('jvmJar'))
}