Skip to content

Commit 4018f22

Browse files
committed
chore(gradle): fix testclient tests
include logback configuration in output
1 parent ee8131a commit 4018f22

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

gradle/build.gradle.kts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,10 @@ tasks {
195195
serverDir.deleteRecursively()
196196
unzipTo(serverDir, deployDir.resolve("software-challenge-server.zip"))
197197

198-
println("Testing TestClient...")
199-
val testClient =
200-
ProcessBuilder(
201-
(project(":test-client").getTasksByName("createStartScripts", false).single() as ScriptsTask).content.split(' ') +
202-
arrayOf("--start-server", "--tests", testClientGames.toString(), "--port", "13055")
203-
).directory(serverDir).start()
198+
val command = (project(":test-client").getTasksByName("createStartScripts", false).single() as ScriptsTask).content.split(' ') +
199+
arrayOf("--start-server", "--tests", testClientGames.toString(), "--port", "13055")
200+
println("Testing TestClient with $command")
201+
val testClient = ProcessBuilder(command).directory(serverDir).start()
204202
if (testClient.waitFor(maxGameLength * testClientGames, TimeUnit.SECONDS)) {
205203
val value = testClient.exitValue()
206204
// TODO check whether TestClient actually played games
@@ -306,11 +304,6 @@ allprojects {
306304
manifest.attributes(
307305
"Main-Class" to project.extensions.getByType<JavaApplication>().mainClass.get(),
308306
"Add-Opens" to arrayOf(
309-
"javafx.controls/javafx.scene.control.skin",
310-
"javafx.controls/javafx.scene.control",
311-
"javafx.graphics/javafx.scene",
312-
// For accessing InputMap used in RangeSliderBehavior
313-
"javafx.controls/com.sun.javafx.scene.control.inputmap",
314307
// Expose list internals for xstream conversion: https://github.com/x-stream/xstream/issues/253
315308
"java.base/java.util").joinToString(" ")
316309
)

helpers/test-client/build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,20 @@ tasks {
2626
content = "java -Dfile.encoding=UTF-8 -Dlogback.configurationFile=logback-tests.xml -jar test-client.jar"
2727
}
2828

29+
val copyLogbackConfig by creating(Copy::class) {
30+
from("src/logback-tests.xml")
31+
into(jar.get().destinationDirectory)
32+
}
33+
2934
jar {
30-
dependsOn(createStartScripts)
35+
dependsOn(createStartScripts, copyLogbackConfig)
3136
doFirst {
3237
manifest.attributes(
3338
"Class-Path" to configurations.default.get()
3439
.map { "lib/" + it.name }
3540
.plus("server.jar")
3641
.joinToString(" ")
3742
)
38-
copy {
39-
from("src/logback-tests.xml")
40-
into(destinationDirectory)
41-
}
4243
}
4344
}
4445

server/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ tasks {
5656
from(runnableDir)
5757
doFirst {
5858
if(project.property("enableTestClient") !in arrayOf(null, false))
59-
from(project(":test-client").getTasksByName("jar", false))
59+
from(arrayOf("jar", "copyLogbackConfig").map { project(":test-client").getTasksByName(it, false) })
6060
from(project(":player").getTasksByName("shadowJar", false))
6161
exec {
6262
commandLine("git", "rev-parse", "HEAD")

0 commit comments

Comments
 (0)