@@ -49,56 +49,56 @@ if (project.findProperty("skipTests") as String? == "true") {
49
49
}
50
50
}
51
51
52
- tasks {
53
- val listTestsInPartition by registering {
54
- group = " Help"
55
- description = " List test tasks in given partition"
56
-
57
- // total of 4 partitions (see modulo 4 below)
58
- var testPartition = (project.findProperty(" testPartition" ) as String? )?.toInt()
59
- if (testPartition == null ) {
60
- throw GradleException (" Test partition must be specified" )
61
- } else if (testPartition < 0 || testPartition >= 4 ) {
62
- throw GradleException (" Invalid test partition" )
63
- }
52
+ if (gradle.startParameter.taskNames.any { it.equals(" listTestsInPartition" ) }) {
53
+ tasks {
54
+ val listTestsInPartition by registering {
55
+ group = " Help"
56
+ description = " List test tasks in given partition"
57
+
58
+ // total of 4 partitions (see modulo 4 below)
59
+ var testPartition = (project.findProperty(" testPartition" ) as String? )?.toInt()
60
+ if (testPartition == null ) {
61
+ throw GradleException (" Test partition must be specified" )
62
+ } else if (testPartition < 0 || testPartition >= 4 ) {
63
+ throw GradleException (" Invalid test partition" )
64
+ }
64
65
65
- val partitionTasks = ArrayList <Test >()
66
- var testPartitionCounter = 0
67
- subprojects {
68
- // relying on predictable ordering of subprojects
69
- // (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4)
70
- // since we are splitting these tasks across different github action jobs
71
- val enabled = testPartitionCounter++ % 4 == testPartition
72
- if (enabled) {
73
- tasks.withType<Test >().configureEach {
74
- partitionTasks.add(this )
66
+ val partitionTasks = ArrayList <Test >()
67
+ var testPartitionCounter = 0
68
+ subprojects {
69
+ // relying on predictable ordering of subprojects
70
+ // (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4)
71
+ // since we are splitting these tasks across different github action jobs
72
+ val enabled = testPartitionCounter++ % 4 == testPartition
73
+ if (enabled) {
74
+ tasks.withType<Test >().configureEach {
75
+ partitionTasks.add(this )
76
+ }
75
77
}
76
78
}
77
- }
78
79
79
- doLast {
80
- File (" test-tasks.txt" ).printWriter().use { writer ->
81
- partitionTasks.forEach { task ->
82
- var taskPath = task.project.path + " :" + task.name
83
- // smoke tests are run separately
84
- // :instrumentation:test runs all instrumentation tests
85
- if (taskPath != " :smoke-tests:test" && taskPath != " :instrumentation:test" ) {
86
- writer.println (taskPath)
80
+ doLast {
81
+ File (" test-tasks.txt" ).printWriter().use { writer ->
82
+ partitionTasks.forEach { task ->
83
+ var taskPath = task.project.path + " :" + task.name
84
+ // smoke tests are run separately
85
+ // :instrumentation:test runs all instrumentation tests
86
+ if (taskPath != " :smoke-tests:test" && taskPath != " :instrumentation:test" ) {
87
+ writer.println (taskPath)
88
+ }
87
89
}
88
90
}
89
91
}
90
- }
91
92
92
- // disable all tasks to stop build
93
- subprojects {
94
- tasks.configureEach {
95
- enabled = false
93
+ // disable all tasks to stop build
94
+ subprojects {
95
+ tasks.configureEach {
96
+ enabled = false
97
+ }
96
98
}
97
99
}
98
100
}
99
- }
100
101
101
- if (gradle.startParameter.taskNames.any { it.equals(" listTestsInPartition" ) }) {
102
102
// disable all tasks to stop build
103
103
project.tasks.configureEach {
104
104
if (this .name != " listTestsInPartition" ) {
0 commit comments