e73b6a7514
Build & Test (NowChessSystems) TeamCity build finished
Implemented module rules as a microservice. ## Summary - Adds Quarkus to the `rule` module, making it independently deployable as a standalone microservice on port 8081 - Exposes all `RuleSet` methods via a REST API at `/api/rules` (candidate moves, legal moves, check/checkmate/stalemate/draw detection, apply move) - Introduces DTOs and a `DtoMapper` for serializing/deserializing chess types (board, moves, game context) as flat JSON strings - Adds `JacksonConfig` for Scala module registration and an `application.yml` for the rule service - Includes Dockerfiles for JVM, legacy-jar, native, and native-micro targets - Full test coverage: 17 `@QuarkusTest` HTTP-level tests + 29 `DtoMapper` unit tests (100% condition coverage) ## Test plan - [ ] `./compile` — all modules build successfully - [ ] `./test` — all tests pass (rule module: 107 tests total) - [ ] `./coverage` — 100% condition coverage in `rule` module - [ ] Rule service runs standalone: `./gradlew :modules:rule:quarkusDev` starts on port 8081 - [ ] `GET /api/rules/candidate-moves` returns valid moves for initial position - [ ] `GET /api/rules/is-check` returns `false` for initial position Co-authored-by: LQ63 <lkhermann@web.de> Co-authored-by: Janis <janis-e@gmx.de> Reviewed-on: #36 Co-authored-by: Leon Hermann <lq@blackhole.local> Co-committed-by: Leon Hermann <lq@blackhole.local>
122 lines
3.6 KiB
Kotlin
122 lines
3.6 KiB
Kotlin
plugins {
|
|
id("scala")
|
|
id("org.scoverage") version "8.1"
|
|
id("io.quarkus")
|
|
}
|
|
|
|
group = "de.nowchess"
|
|
version = "1.0-SNAPSHOT"
|
|
|
|
@Suppress("UNCHECKED_CAST")
|
|
val versions = rootProject.extra["VERSIONS"] as Map<String, String>
|
|
@Suppress("UNCHECKED_CAST")
|
|
val scoverageExcluded = rootProject.extra["SCOVERAGE_EXCLUDED"] as List<String>
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
scala {
|
|
scalaVersion = versions["SCALA3"]!!
|
|
}
|
|
|
|
scoverage {
|
|
scoverageVersion.set(versions["SCOVERAGE"]!!)
|
|
excludedFiles.set(scoverageExcluded)
|
|
}
|
|
|
|
tasks.withType<ScalaCompile> {
|
|
scalaCompileOptions.additionalParameters = listOf("-encoding", "UTF-8")
|
|
}
|
|
|
|
val quarkusPlatformGroupId: String by project
|
|
val quarkusPlatformArtifactId: String by project
|
|
val quarkusPlatformVersion: String by project
|
|
|
|
|
|
dependencies {
|
|
|
|
compileOnly("org.scala-lang:scala3-compiler_3") {
|
|
version {
|
|
strictly(versions["SCALA3"]!!)
|
|
}
|
|
}
|
|
implementation("org.scala-lang:scala3-library_3") {
|
|
version {
|
|
strictly(versions["SCALA3"]!!)
|
|
}
|
|
}
|
|
|
|
implementation(project(":modules:api"))
|
|
implementation(project(":modules:bot"))
|
|
|
|
|
|
implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
|
|
implementation("io.quarkus:quarkus-rest")
|
|
implementation("io.quarkus:quarkus-hibernate-orm")
|
|
implementation("io.quarkus:quarkus-rest-client-jackson")
|
|
implementation("io.quarkus:quarkus-rest-client")
|
|
implementation("io.quarkus:quarkus-rest-jackson")
|
|
implementation("io.quarkus:quarkus-config-yaml")
|
|
implementation("io.quarkus:quarkus-smallrye-fault-tolerance")
|
|
implementation("io.quarkus:quarkus-smallrye-jwt")
|
|
implementation("io.quarkus:quarkus-smallrye-health")
|
|
implementation("io.quarkus:quarkus-micrometer")
|
|
implementation("io.quarkus:quarkus-arc")
|
|
|
|
implementation("com.fasterxml.jackson.module:jackson-module-scala_3:${versions["JACKSON_SCALA"]!!}")
|
|
|
|
|
|
testImplementation(project(":modules:io"))
|
|
testImplementation(project(":modules:rule"))
|
|
|
|
testImplementation(platform("org.junit:junit-bom:5.13.4"))
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
testImplementation("org.scalatest:scalatest_3:${versions["SCALATEST"]!!}")
|
|
testImplementation("co.helmethair:scalatest-junit-runner:${versions["SCALATEST_JUNIT"]!!}")
|
|
testImplementation("io.quarkus:quarkus-junit5")
|
|
testImplementation("io.quarkus:quarkus-junit5-mockito")
|
|
testImplementation("io.rest-assured:rest-assured")
|
|
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
|
}
|
|
|
|
configurations.matching { !it.name.startsWith("scoverage") }.configureEach {
|
|
resolutionStrategy.force("org.scala-lang:scala-library:${versions["SCALA_LIBRARY"]!!}")
|
|
}
|
|
configurations.scoverage {
|
|
resolutionStrategy.eachDependency {
|
|
if (requested.group == "org.scoverage" && requested.name.startsWith("scalac-scoverage-plugin_")) {
|
|
useTarget("${requested.group}:scalac-scoverage-plugin_2.13.16:2.3.0")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType<JavaCompile> {
|
|
options.encoding = "UTF-8"
|
|
options.compilerArgs.add("-parameters")
|
|
}
|
|
|
|
tasks.withType<Jar>().configureEach {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
tasks.test {
|
|
useJUnitPlatform {
|
|
includeEngines("scalatest", "junit-jupiter")
|
|
testLogging {
|
|
events("passed", "skipped", "failed")
|
|
}
|
|
}
|
|
finalizedBy(tasks.reportScoverage)
|
|
}
|
|
tasks.reportScoverage {
|
|
dependsOn(tasks.test)
|
|
}
|
|
|
|
tasks.jar {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|