File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 55 */
66
77import datadog.gradle.plugin.ci.findAffectedTaskPath
8+ import org.gradle.api.tasks.testing.Test
89import java.io.File
910import kotlin.math.abs
1011
@@ -20,6 +21,15 @@ allprojects {
2021 val currentTaskPartition = abs(project.path.hashCode() % taskPartitionCount.toInt())
2122 extra.set(" activePartition" , currentTaskPartition == taskPartition.toInt())
2223 }
24+
25+ // Disable test tasks if not in active partition
26+ val activePartitionProvider = providers.provider {
27+ project.extra.properties[" activePartition" ] as ? Boolean ? : true
28+ }
29+
30+ tasks.withType<Test >().configureEach {
31+ enabled = activePartitionProvider.get()
32+ }
2333}
2434
2535fun relativeToGitRoot (f : File ): File {
Original file line number Diff line number Diff line change @@ -32,14 +32,9 @@ val skipTestsProvider = rootProject.providers.gradleProperty("skipTests")
3232val skipForkedTestsProvider = rootProject.providers.gradleProperty(" skipForkedTests" )
3333val skipFlakyTestsProvider = rootProject.providers.gradleProperty(" skipFlakyTests" )
3434val runFlakyTestsProvider = rootProject.providers.gradleProperty(" runFlakyTests" )
35- val activePartitionProvider = providers.provider {
36- project.extra.properties[" activePartition" ] as ? Boolean ? : true
37- }
3835
3936// Go through the Test tasks and configure them
4037tasks.withType<Test >().configureEach {
41- enabled = activePartitionProvider.get()
42-
4338 // Disable all tests if skipTests property was specified
4439 onlyIf(" skipTests are undefined or false" ) { ! skipTestsProvider.isPresent }
4540
You can’t perform that action at this time.
0 commit comments