Files
2020-05-18 08:59:41 +03:00

95 lines
2.8 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 {
mavenCentral()
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/ktor'
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev'
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-js-wrappers'
}
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = '1.8'
}
withJava()
}
js {
browser {
binaries.executable()
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib-jdk8')
implementation 'io.ktor:ktor-server-netty:1.2.6'
implementation 'io.ktor:ktor-html-builder:1.2.6'
implementation 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.1'
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
}
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
implementation 'org.jetbrains.kotlinx:kotlinx-html-js:0.7.1'
implementation 'org.jetbrains:kotlin-react:16.13.0-pre.93-kotlin-KOTLIN_VERSION'
implementation 'org.jetbrains:kotlin-react-dom:16.13.0-pre.93-kotlin-KOTLIN_VERSION'
implementation npm('react','16.13.0')
implementation npm('react-dom','16.13.0')
implementation npm('react-is','16.13.0')
implementation 'org.jetbrains:kotlin-styled:1.0.0-pre.93-kotlin-KOTLIN_VERSION'
implementation npm('styled-components','5.0.0')
implementation npm('inline-style-prefixer','5.1.0')
}
}
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'))
}