Skip to content

Commit 89d1662

Browse files
authored
Gradle config cache: listTestsInPartition (#15396)
1 parent 95b4bc7 commit 89d1662

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

build.gradle.kts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,25 @@ if (gradle.startParameter.taskNames.contains("listTestsInPartition")) {
7676
throw GradleException("Invalid test partition")
7777
}
7878

79-
val partitionTasks = ArrayList<Test>()
79+
val partitionTasks = ArrayList<String>()
8080
var testPartitionCounter = 0
8181
subprojects {
8282
// relying on predictable ordering of subprojects
8383
// (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4)
8484
// since we are splitting these tasks across different github action jobs
8585
val enabled = testPartitionCounter++ % 4 == testPartition
8686
if (enabled) {
87+
val projectPath = this.path
8788
tasks.withType<Test>().configureEach {
88-
partitionTasks.add(this)
89+
val taskPath = projectPath + ":" + this.name
90+
partitionTasks.add(taskPath)
8991
}
9092
}
9193
}
9294

9395
doLast {
9496
File("test-tasks.txt").printWriter().use { writer ->
95-
partitionTasks.forEach { task ->
96-
var taskPath = task.project.path + ":" + task.name
97+
partitionTasks.forEach { taskPath ->
9798
// smoke tests are run separately
9899
// :instrumentation:test runs all instrumentation tests
99100
if (taskPath != ":smoke-tests:test" && taskPath != ":instrumentation:test") {

0 commit comments

Comments
 (0)