Skip to content

Commit a1aad5d

Browse files
committed
chore(gradle): clean up task groups and change testTestClient port
1 parent 796ba5b commit a1aad5d

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

gradle/build.gradle.kts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ println("Current version: $version Game: $game")
2323
val deployDir by extra { buildDir.resolve("deploy") }
2424
val deployedPlayer by extra { "simpleclient-$gameName-$version.jar" }
2525
val testLogDir by extra { buildDir.resolve("tests") }
26+
val documentedProjects = arrayOf("sdk", "plugin")
2627

2728
subprojects {
2829
apply(plugin = "java-library")
2930
apply(plugin = "kotlin")
3031
}
3132

3233
val doAfterEvaluate = ArrayList<(Project) -> Unit>()
33-
val mainGroup = "_main"
3434
tasks {
3535
val startServer by creating {
3636
dependsOn(":server:run")
37-
group = mainGroup
37+
group = "application"
3838
}
3939

4040
val doc by creating(DokkaTask::class) {
41-
val includedProjects = arrayOf("sdk", "plugin")
41+
val includedProjects = documentedProjects
4242
mustRunAfter(includedProjects.map { "$it:classes" })
4343
moduleName = "Software-Challenge API $version"
4444
val sourceSets = includedProjects.map { project(it).sourceSets.main.get() }
@@ -55,14 +55,15 @@ tasks {
5555
val deploy by creating {
5656
dependsOn(doc)
5757
dependOnSubprojects()
58-
group = mainGroup
58+
group = "distribution"
5959
description = "Zips everything up for release into build/deploy/"
60+
outputs.dir(deployDir)
6061
}
6162

6263
val release by creating {
6364
dependsOn(deploy)
64-
group = mainGroup
65-
description = "Prepares a new Release by bumping the version and creating a commit and a git tag"
65+
group = "distribution"
66+
description = "Prepares a new Release by bumping the version and creating a commit with a git tag of the new version"
6667
doLast {
6768
fun edit(original: String, version: String, new: Int) =
6869
if (original.startsWith("socha.version.$version"))
@@ -104,6 +105,7 @@ tasks {
104105
}
105106

106107
val testGame by creating {
108+
group = "verification"
107109
dependsOn(clearTestLogs, ":server:deploy", ":player:deploy")
108110
doFirst {
109111
testLogDir.mkdirs()
@@ -163,8 +165,9 @@ tasks {
163165
}
164166

165167
val testTestClient by creating {
168+
group = "verification"
166169
dependsOn(clearTestLogs, ":server:deploy")
167-
mustRunAfter(testGame)
170+
shouldRunAfter(testGame)
168171
val testClientGames = 3
169172
doFirst {
170173
val tmpDir = buildDir.resolve("tmp")
@@ -177,7 +180,7 @@ tasks {
177180
println("Testing TestClient...")
178181
val testClient = ProcessBuilder(
179182
project("test-client").tasks.getByName<ScriptsTask>("createScripts").content.split(" ") +
180-
listOf("--start-server", "--tests", "$testClientGames"))
183+
listOf("--start-server", "--tests", testClientGames.toString(), "--port", "13055"))
181184
.redirectOutput(testLogDir.resolve("test-client.log")).redirectError(testLogDir.resolve("test-client-err.log"))
182185
.directory(unzipped).start()
183186
if (testClient.waitFor(maxGameLength * testClientGames, TimeUnit.SECONDS)) {
@@ -193,26 +196,22 @@ tasks {
193196
}
194197

195198
val integrationTest by creating {
196-
group = mainGroup
199+
group = "verification"
197200
dependsOn(testGame, testTestClient)
198201
shouldRunAfter(test)
199202
}
200203

201204
clean {
202-
group = mainGroup
203205
dependOnSubprojects()
204206
}
205207
test {
206-
group = mainGroup
207208
dependOnSubprojects()
208209
}
209210
check {
210-
group = mainGroup
211-
if (!hasProperty("nointegration") && versionObject.minor > 0)
211+
if (!project.hasProperty("nointegration") && versionObject.minor > 0)
212212
dependsOn(integrationTest)
213213
}
214214
build {
215-
group = mainGroup
216215
dependsOn(deploy)
217216
}
218217
}
@@ -228,7 +227,7 @@ allprojects {
228227
jcenter()
229228
maven("http://dist.wso2.org/maven2")
230229
}
231-
if (this.name in arrayOf("sdk", "plugin")) {
230+
if (this.name in documentedProjects) {
232231
apply(plugin = "maven")
233232
tasks {
234233
val doc by creating(DokkaTask::class) {

0 commit comments

Comments
 (0)