Ready for first release

This commit is contained in:
2026-08-09 23:13:04 +02:00
parent a90b2ebeca
commit 8494a1a9bb
9 changed files with 81 additions and 21 deletions
+2 -1
View File
@@ -46,4 +46,5 @@ bin/
*.db *.db
.env .env
.idea/ .idea/
artifacts/
Executable
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
./gradlew :clients:cli:shadowJar
./gradlew :clients:compose:createDistributable
./gradlew :clients:compose:wasmJsBrowserProductionWebpack
./gradlew :server:installDist
mkdir -p artifacts
cp clients/cli/build/libs/phoebench-cli.jar artifacts/
(cd clients/compose/build/compose/binaries/main/app/com.jaytux.phoebench.clients && zip phoebench-linux.zip -r bin/ lib/)
cp clients/compose/build/compose/binaries/main/app/com.jaytux.phoebench.clients/phoebench-linux.zip artifacts/
mkdir -p artifacts/wasm
cp clients/compose/build/kotlin-webpack/wasmJs/productionExecutable/* clients/compose/src/wasmJsMain/resources/* artifacts/wasm
(cd artifacts/wasm && zip phoebench-wasm.zip -r ./*)
mv artifacts/wasm/phoebench-wasm.zip artifacts/
rm -fr artifacts/wasm
(cd server/build/install/server/ && zip phoebench-server.zip -r bin/ lib/)
cp server/build/install/server/phoebench-server.zip artifacts
+1 -1
View File
@@ -12,4 +12,4 @@ repositories {
mavenCentral() mavenCentral()
} }
version = "0.2.0-dev" version = "1.0.0-dev"
+6
View File
@@ -1,3 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { plugins {
alias(libs.plugins.jvm) alias(libs.plugins.jvm)
application application
@@ -40,4 +42,8 @@ kotlin {
freeCompilerArgs.add("-Xcontext-parameters") freeCompilerArgs.add("-Xcontext-parameters")
optIn.add("kotlin.uuid.ExperimentalUuidApi") optIn.add("kotlin.uuid.ExperimentalUuidApi")
} }
}
tasks.withType<ShadowJar> {
archiveFileName = "phoebench-cli.jar"
} }
+6
View File
@@ -97,6 +97,12 @@ compose.desktop {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "com.jaytux.phoebench.clients" packageName = "com.jaytux.phoebench.clients"
packageVersion = rootProject.version.toString().split('-')[0] packageVersion = rootProject.version.toString().split('-')[0]
jvmArgs += listOf("--enable-native-access=ALL-UNNAMED")
includeAllModules = true
buildTypes.release.proguard {
configurationFiles.from(file("proguard-rules.pro"))
}
} }
} }
} }
+11
View File
@@ -0,0 +1,11 @@
-keep class com.github.javakeyring.** { *; }
-dontwarn com.github.javakeyring.**
-keep class com.sun.jna.** { *; }
-dontwarn com.sun.jna.**
-keepclassmembers class * extends com.sun.jna.Structure {
*** *;
}
-keepclassmembers class * extends com.sun.jna.Callback {
*** *;
}
+14 -3
View File
@@ -1,3 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { plugins {
alias(libs.plugins.jvm) alias(libs.plugins.jvm)
alias(libs.plugins.ktor) alias(libs.plugins.ktor)
@@ -5,7 +7,6 @@ plugins {
} }
group = "com.jaytux.phoebench" group = "com.jaytux.phoebench"
//version = "1.0-SNAPSHOT"
repositories { repositories {
mavenCentral() mavenCentral()
@@ -65,12 +66,22 @@ kotlin {
} }
application { application {
mainClass.set("com.jaytux.phoebench.server.MainKt") mainClass = "io.ktor.server.netty.EngineMain"
} }
tasks.withType<Jar> { tasks.withType<Jar> {
manifest { manifest {
attributes["Main-Class"] = application.mainClass attributes["Main-Class"] = application.mainClass
} }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.WARN
}
ktor {
fatJar {
}
}
tasks.withType<ShadowJar> {
mergeServiceFiles()
append("reference.conf")
} }
@@ -10,7 +10,6 @@ import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.* import io.ktor.server.application.*
import io.ktor.server.auth.* import io.ktor.server.auth.*
import io.ktor.server.auth.jwt.* import io.ktor.server.auth.jwt.*
import io.ktor.server.netty.*
import io.ktor.server.plugins.autohead.* import io.ktor.server.plugins.autohead.*
import io.ktor.server.plugins.calllogging.* import io.ktor.server.plugins.calllogging.*
import io.ktor.server.plugins.contentnegotiation.* import io.ktor.server.plugins.contentnegotiation.*
@@ -24,12 +23,10 @@ import kotlinx.serialization.json.Json
import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import kotlin.uuid.Uuid import kotlin.uuid.Uuid
fun main(args: Array<String>) {
DB.db
EngineMain.main(args)
}
fun Application.module() { fun Application.module() {
DB.db
println("Entering module...")
install(ContentNegotiation) { install(ContentNegotiation) {
json() json()
} }
@@ -147,22 +144,22 @@ fun Application.module() {
get("{...}") { get("{...}") {
println("Fallback for GET ${call.request.path()} triggered.") println("Fallback for GET ${call.request.path()} triggered.")
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}")) call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
} }
post("{...}") { post("{...}") {
println("Fallback for POST ${call.request.path()} triggered.") println("Fallback for POST ${call.request.path()} triggered.")
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}")) call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
} }
delete("{...}") { delete("{...}") {
println("Fallback for DELETE ${call.request.path()} triggered.") println("Fallback for DELETE ${call.request.path()} triggered.")
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}")) call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
} }
patch("{...}") { patch("{...}") {
println("Fallback for PATCH ${call.request.path()} triggered.") println("Fallback for PATCH ${call.request.path()} triggered.")
call.respond(HttpStatusCode.NotFound, ErrorResponse("Could not find ${call.request.path()}")) call.respondText(status = HttpStatusCode.NotFound, text = Json.encodeToString(ErrorResponse("Could not find ${call.request.path()}")), contentType = ContentType.Application.Json)
} }
} }
} }
+11 -6
View File
@@ -1,18 +1,23 @@
ktor { ktor {
deployment { deployment {
port = ${PORT} port = 8080
port = ${?PORT}
} }
application { application {
modules = [com.jaytux.phoebench.server.MainKt.module] modules = [com.jaytux.phoebench.server.MainKt.module]
} }
jwt { jwt {
secret = ${JWT_SECRET} secret = "NO_SECRET_SET!"
issuer = ${JWT_ISSUER} secret = ${?JWT_SECRET}
audience = ${JWT_AUDIENCE} issuer = "http://0.0.0.0"
realm = ${JWT_REALM} issuer = ${?JWT_ISSUER}
audience = "http://0.0.0.0"
audience = ${?JWT_AUDIENCE}
realm = "phoebench"
realm = ${?JWT_REALM}
} }
cors { cors {
enableLocalhostOn = ${PHOEBENCH_DEV_CLIENT_PORT} enableLocalhostOn = ${?PHOEBENCH_DEV_CLIENT_PORT}
browserOrigin = ${?PHOEBENCH_SAFE_CLIENT} browserOrigin = ${?PHOEBENCH_SAFE_CLIENT}
} }