Skip to content

Commit 99521ff

Browse files
committed
build(player): add runTimeout task to run sleepy player
1 parent f06720f commit 99521ff

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

player/build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ tasks {
104104
from(prepareZip)
105105
into(execDir)
106106
}
107+
val logic = execDir.resolve("src/main/sc/player/Logic.java")
108+
val lines = logic.readLines()
109+
logic.writeText(lines.map {
110+
it.replace(
111+
"// Hier intelligente Strategie zur Auswahl des Zuges einfügen",
112+
"try {Thread.sleep(3000);} catch(InterruptedException e) {throw new RuntimeException(e);}"
113+
)
114+
}.joinToString(System.lineSeparator()))
107115
// required by gradle to distinguish the test build
108116
execDir.resolve("settings.gradle").createNewFile()
109117
}
@@ -122,4 +130,11 @@ tasks {
122130
}
123131
}
124132

133+
// Run a player that hits the soft-timeout
134+
val runTimeout by creating(Exec::class) {
135+
dependsOn(playerTest)
136+
workingDir(playerTest.workingDir)
137+
commandLine("java", "-jar", workingDir.resolve("${game}_client.jar"))
138+
}
139+
125140
}

0 commit comments

Comments
 (0)