portal/build.gradle
Lars Westermann b7d6476a70
Add repositories
- Make model classes imutable
- Move model classes to common module
- Add repositories for backend and frontend
  - Backend repositories communicates with sqlite
  - Frontend repositories commuincates with rest api
- Add rest api
  - Authentication via cookies
- Add coroutines to forntend
- Add change listener to repositories
- Transmit change events to frontend repositories via websocket
- Switch to server side sessions
- Move setup from ui to cli
2019-05-12 16:40:21 +02:00

191 lines
5.2 KiB
Groovy

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id 'kotlin-multiplatform' version '1.3.31'
id 'kotlinx-serialization' version '1.3.31'
id "org.kravemir.gradle.sass" version "1.2.2"
id "com.github.johnrengelman.shadow" version "4.0.4"
}
group "de.kif"
version "0.1.0"
repositories {
jcenter()
maven { url "http://dl.bintray.com/kotlin/ktor" }
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url "https://kotlin.bintray.com/kotlin-js-wrappers" }
mavenCentral()
}
def ktor_version = '1.1.5'
def serialization_version = '0.11.0'
kotlin {
jvm() {
compilations.all {
kotlinOptions {
freeCompilerArgs += [
"-Xuse-experimental=io.ktor.util.KtorExperimentalAPI"
]
}
}
}
js() {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "de.westermann:KObserve-metadata:0.9.1"
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"
implementation "io.ktor:ktor-server-sessions:$ktor_version"
implementation "io.ktor:ktor-websockets:$ktor_version"
implementation "io.ktor:ktor-jackson:$ktor_version"
implementation 'org.jetbrains:kotlin-css-jvm:1.0.0-pre.70-kotlin-1.3.21'
implementation "io.ktor:ktor-html-builder:$ktor_version"
implementation 'org.xerial:sqlite-jdbc:3.25.2'
implementation 'org.jetbrains.exposed:exposed:0.12.2'
implementation 'org.mindrot:jbcrypt:0.4'
implementation "de.westermann:KObserve-jvm:0.9.1"
api 'io.github.microutils:kotlin-logging:1.6.23'
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"
implementation "de.westermann:KObserve-js:0.9.1"
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
}
}
sass {
main {
srcDir = file("$projectDir/src/jsMain/resources/style")
outDir = file("$buildDir/processedResources/js/main/style")
exclude = "**/*.css"
}
}
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()) {
from zipTree(it.absolutePath).matching {
include '*.js'
exclude '*.meta.js'
}
}
}
into webFolder
}
}
}
jsJar.dependsOn(populateWebFolder)
def mainClassName = 'de.kif.backend.Main'
task run(type: JavaExec, dependsOn: [jvmMainClasses, jsJar]) {
main = mainClassName
classpath {
[
kotlin.targets.jvm.compilations.main.output.allOutputs.files,
configurations.jvmRuntimeClasspath,
]
}
args = []
standardInput = System.in
}
clean.doFirst {
delete webFolder
delete ".sessions"
}
task jar(type: ShadowJar, dependsOn: [jvmMainClasses, jsMainClasses, sass]) {
from kotlin.targets.jvm.compilations.main.output
from(kotlin.targets.js.compilations.main.output) {
into "web"
exclude '*.meta.js'
}
from(kotlin.sourceSets.jsMain.resources.srcDirs) {
into "web"
exclude '*.meta.js'
}
configurations = [kotlin.targets.jvm.compilations.main.compileDependencyFiles]
baseName = rootProject.name
classifier = null
version = null
manifest {
attributes 'Main-Class': mainClassName
}
}