portal/build.gradle

186 lines
5.1 KiB
Groovy
Raw Normal View History

2019-02-06 17:41:48 +01:00
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2019-02-05 22:18:15 +01:00
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
2019-05-10 11:59:41 +02:00
id 'kotlin-multiplatform' version '1.3.31'
id 'kotlinx-serialization' version '1.3.31'
2019-02-05 22:18:15 +01:00
id "org.kravemir.gradle.sass" version "1.2.2"
2019-02-06 17:41:48 +01:00
id "com.github.johnrengelman.shadow" version "4.0.4"
2019-02-05 22:18:15 +01:00
}
group "de.kif"
version "0.1.0"
repositories {
jcenter()
maven { url "http://dl.bintray.com/kotlin/ktor" }
maven { url "https://kotlin.bintray.com/kotlinx" }
2019-05-10 11:59:41 +02:00
maven { url "https://kotlin.bintray.com/kotlin-js-wrappers" }
2019-02-05 22:18:15 +01:00
mavenCentral()
}
2019-05-10 11:59:41 +02:00
def ktor_version = '1.1.5'
def serialization_version = '0.11.0'
2019-02-05 22:18:15 +01:00
kotlin {
2019-04-04 17:38:31 +02:00
jvm() {
compilations.all {
kotlinOptions {
freeCompilerArgs += [
"-Xuse-experimental=io.ktor.locations.KtorExperimentalLocationsAPI",
"-Xuse-experimental=io.ktor.util.KtorExperimentalAPI"
]
}
}
}
2019-02-05 22:18:15 +01:00
js() {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib-jdk8')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
implementation "io.ktor:ktor-server-netty:$ktor_version"
implementation "io.ktor:ktor-auth:$ktor_version"
2019-04-04 17:38:31 +02:00
implementation "io.ktor:ktor-locations:$ktor_version"
2019-05-10 11:59:41 +02:00
implementation "io.ktor:ktor-websockets:$ktor_version"
implementation 'org.jetbrains:kotlin-css-jvm:1.0.0-pre.70-kotlin-1.3.21'
2019-02-05 22:18:15 +01:00
implementation "io.ktor:ktor-html-builder:$ktor_version"
2019-04-04 17:38:31 +02:00
implementation 'org.xerial:sqlite-jdbc:3.25.2'
implementation 'org.jetbrains.exposed:exposed:0.12.2'
implementation 'org.mindrot:jbcrypt:0.4'
api 'io.github.microutils:kotlin-logging:1.6.23'
2019-02-05 22:18:15 +01:00
api 'ch.qos.logback:logback-classic:1.2.3'
api 'org.fusesource.jansi:jansi:1.8'
}
}
jvmTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version"
2019-05-10 11:59:41 +02:00
implementation "de.westermann:KObserve-js:0.9.1"
2019-02-05 22:18:15 +01:00
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
}
}
2019-02-06 17:41:48 +01:00
sass {
2019-02-05 22:18:15 +01:00
main {
srcDir = file("$projectDir/src/jsMain/resources/style")
outDir = file("$buildDir/processedResources/js/main/style")
2019-04-04 17:38:31 +02:00
exclude = "**/*.css"
2019-02-05 22:18:15 +01:00
}
}
def webFolder = new File(project.buildDir, "../web")
def jsCompilations = kotlin.targets.js.compilations
task populateWebFolder(dependsOn: [jsMainClasses, sass]) {
doLast {
copy {
from jsCompilations.main.output
from kotlin.sourceSets.jsMain.resources.srcDirs
jsCompilations.test.runtimeDependencyFiles.each {
if (it.exists() && !it.isDirectory()) {
2019-04-04 17:38:31 +02:00
from zipTree(it.absolutePath).matching {
include '*.js'
exclude '*.meta.js'
}
2019-02-05 22:18:15 +01:00
}
}
into webFolder
}
}
}
jsJar.dependsOn(populateWebFolder)
2019-02-06 17:41:48 +01:00
def mainClassName = 'de.kif.backend.Main'
2019-02-05 22:18:15 +01:00
task run(type: JavaExec, dependsOn: [jvmMainClasses, jsJar]) {
2019-02-06 17:41:48 +01:00
main = mainClassName
classpath {
[
kotlin.targets.jvm.compilations.main.output.allOutputs.files,
configurations.jvmRuntimeClasspath,
]
}
2019-02-05 22:18:15 +01:00
args = []
}
clean.doFirst {
delete webFolder
}
2019-02-06 17:41:48 +01:00
task jar(type: ShadowJar, dependsOn: [jvmMainClasses, jsMainClasses, sass]) {
from kotlin.targets.jvm.compilations.main.output
2019-04-04 17:38:31 +02:00
from(kotlin.targets.js.compilations.main.output) {
2019-02-06 17:41:48 +01:00
into "web"
2019-04-04 17:38:31 +02:00
exclude '*.meta.js'
2019-02-06 17:41:48 +01:00
}
2019-04-04 17:38:31 +02:00
from(kotlin.sourceSets.jsMain.resources.srcDirs) {
2019-02-06 17:41:48 +01:00
into "web"
2019-04-04 17:38:31 +02:00
exclude '*.meta.js'
2019-02-06 17:41:48 +01:00
}
configurations = [kotlin.targets.jvm.compilations.main.compileDependencyFiles]
baseName = rootProject.name
classifier = null
version = null
manifest {
attributes 'Main-Class': mainClassName
}
}