Make fat jar a thing, modularize app.
This commit is contained in:
parent
b5d1525184
commit
ce7d231c9a
4 changed files with 39 additions and 1 deletions
|
@ -4,8 +4,16 @@ A simple buzzer implementation using web technologies.
|
|||
|
||||
## Usage
|
||||
|
||||
### Preconditions
|
||||
|
||||
You need a JDK, version 11 upwards.
|
||||
|
||||
### Build
|
||||
|
||||
Until artifact storage is provided, start the service using `gradlew run` from within the project directory.
|
||||
|
||||
Alternatively, you can create the artifact using `gradlew shadowJar`. The output will be written to `<projectDir>/build/libs/`. Then run it using `java -jar <JarFile>`.
|
||||
|
||||
After it successfully launched, you have access to two clients.
|
||||
|
||||
### Player-Client
|
||||
|
@ -35,6 +43,7 @@ Your surface consists of three parts. After a game has started, and some player
|
|||
|
||||
This project contains a weird mixture of technologies that I wanted to play around with:
|
||||
|
||||
* Currently, there is no check for uniqueness of player names, and the name is used as identifier (that's the simplest way to be consistent across reconnects). Make sure each player uses a different name!
|
||||
* The server-portion is based on the [ktor][ktor] framework, a rather lightweight, code-configured web servicing library.
|
||||
* The clients' HTML files are created on the fly using the domain specific HTML language provided by [kotlinx-html][kotlinxhtml].
|
||||
* Javascript and data binding in the clients is achieved by embedding [alpine-js][alpinejs], in conjunction with a few extension functions to integrate it into kotlinx-html.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
val ktor_version: String by project
|
||||
val kotlin_version: String by project
|
||||
val logback_version: String by project
|
||||
|
@ -6,12 +8,15 @@ val kotlinx_html_version: String by project
|
|||
plugins {
|
||||
application
|
||||
kotlin("jvm") version "1.5.31"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.0"
|
||||
}
|
||||
|
||||
group = "de.pheerai.buzzer"
|
||||
version = "0.0.1"
|
||||
|
||||
application {
|
||||
mainClass.set("de.pheerai.buzzer.ApplicationKt")
|
||||
applicationDefaultJvmArgs = listOf("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-Dio.netty.tryReflectionSetAccessible=true")
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -28,3 +33,16 @@ dependencies {
|
|||
testImplementation("io.ktor:ktor-server-tests:$ktor_version")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlin_version")
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<JavaCompile>().configureEach {
|
||||
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||
}
|
||||
|
||||
withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package de.pheerai.buzzer.data
|
|||
|
||||
import io.ktor.http.cio.websocket.*
|
||||
|
||||
|
||||
@JvmInline
|
||||
value class PlayerSocket(val session: WebSocketSession)
|
||||
@JvmInline
|
||||
|
|
12
src/main/kotlin/module-info.java
Normal file
12
src/main/kotlin/module-info.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
module buzzer {
|
||||
requires ktor.server.host.common.jvm;
|
||||
requires ktor.server.netty.jvm;
|
||||
requires ktor.server.core.jvm;
|
||||
requires ktor.websockets.jvm;
|
||||
requires ktor.html.builder.jvm;
|
||||
requires org.slf4j;
|
||||
requires ktor.http.cio.jvm;
|
||||
requires kotlinx.coroutines.core.jvm;
|
||||
requires kotlin.stdlib;
|
||||
requires kotlinx.html.jvm;
|
||||
}
|
Loading…
Reference in a new issue