chore: Update build configuration for Scoverage and ScalaTest integration

This commit is contained in:
2026-03-22 14:19:44 +01:00
parent 186db062c1
commit 5a21e57ca9
7 changed files with 47 additions and 174 deletions
+24 -8
View File
@@ -1,6 +1,6 @@
plugins {
jacoco
id("scala")
id("org.scoverage") version "8.1"
}
group = "de.nowchess"
@@ -14,14 +14,19 @@ repositories {
}
scala {
versions["SCALA3"]!!
scalaVersion = versions["SCALA3"]!!
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
scoverage {
scoverageVersion.set(versions["SCOVERAGE"]!!)
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
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")
}
}
}
dependencies {
@@ -42,11 +47,22 @@ dependencies {
}
}
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation(platform("org.junit:junit-bom:5.13.4"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.scalatest:scalatest_3:${versions["SCALATEST"]!!}")
testImplementation("org.scalatestplus:junit-5-13_3:${versions["SCALATESTPLUS_JUNIT5"]!!}")
}
tasks.test {
useJUnitPlatform()
useJUnitPlatform {
includeEngines("scalatest")
testLogging {
events("passed", "skipped", "failed")
}
}
finalizedBy(tasks.reportScoverage)
}
tasks.reportScoverage {
dependsOn(tasks.test)
}
+15 -34
View File
@@ -1,6 +1,6 @@
plugins {
id("scala")
jacoco
id("org.scoverage") version "8.1"
application
}
@@ -15,7 +15,11 @@ repositories {
}
scala {
versions["SCALA3"]!!
scalaVersion = versions["SCALA3"]!!
}
scoverage {
scoverageVersion.set(versions["SCOVERAGE"]!!)
}
application {
@@ -31,17 +35,6 @@ tasks.named<JavaExec>("run") {
standardInput = System.`in`
}
tasks.test {
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
html.required.set(true)
}
}
dependencies {
implementation("org.scala-lang:scala3-compiler_3") {
@@ -54,29 +47,17 @@ dependencies {
strictly(versions["SCALA3"]!!)
}
}
implementation("org.scala-lang:scala-library") {
version {
strictly(versions["SCALA_LIBRARY"]!!)
}
}
implementation(project(":modules:api"))
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.scalatest:scalatest_3:3.2.19")
testRuntimeOnly("org.junit.platform:junit-platform-engine:1.13.1")
testRuntimeOnly("org.scalatestplus:junit-5-13_3:3.2.19.0")
testImplementation("org.scalatest:scalatest_3:${versions["SCALATEST"]!!}")
testImplementation("org.scalatestplus:junit-5-11_3:${versions["SCALATESTPLUS_JUNIT5"]!!}")
}
tasks {
test{
useJUnitPlatform {
includeEngines("scalatest")
testLogging {
events("passed", "skipped", "failed")
}
}
}
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.reportScoverage)
}
tasks.reportScoverage {
dependsOn(tasks.test)
}