Skip to content

Commit cda16fe

Browse files
committed
build(player): slight run logic and documentation enhancement
1 parent 5e3eede commit cda16fe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

player/build.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ tasks {
7878

7979
run.configure {
8080
args = System.getProperty("args", "").split(" ")
81+
mustRunAfter(":server:run")
8182
}
8283

8384
val bundleDir: File by project
@@ -96,6 +97,7 @@ tasks {
9697
archiveFileName.set("player-$gameName-src.zip")
9798
}
9899

100+
/** Build a player that times out. */
99101
val playerTest by creating(Exec::class) {
100102
group = "verification"
101103
dependsOn(prepareZip)
@@ -108,12 +110,12 @@ tasks {
108110
}
109111
val logic = execDir.resolve("src/main/sc/player/Logic.java")
110112
val lines = logic.readLines()
111-
logic.writeText(lines.map {
113+
logic.writeText(lines.joinToString(System.lineSeparator()) {
112114
it.replace(
113115
"// Hier intelligente Strategie zur Auswahl des Zuges einfügen",
114116
"try {Thread.sleep(3000);} catch(InterruptedException e) {throw new RuntimeException(e);}"
115117
)
116-
}.joinToString(System.lineSeparator()))
118+
})
117119
// required by gradle to distinguish the test build
118120
execDir.resolve("settings.gradle").createNewFile()
119121
}
@@ -132,8 +134,10 @@ tasks {
132134
}
133135
}
134136

135-
// Run a player that hits the soft-timeout
137+
/** Run a player that hits the soft-timeout. */
138+
// TODO incorporate into a proper test
136139
val runTimeout by creating(Exec::class) {
140+
group = "verification"
137141
dependsOn(playerTest)
138142
workingDir(playerTest.workingDir)
139143
commandLine("java", "-jar", workingDir.resolve("${game}_client.jar"))

0 commit comments

Comments
 (0)