OpenSearch/gradle/bwc-test.gradle

32 lines
790 B
Groovy
Raw Normal View History

import org.opensearch.gradle.Version
import org.opensearch.gradle.info.BuildParams
ext.bwcTaskName = { Version version ->
return "v${version}#bwcTest"
}
def bwcTestSnapshots = tasks.register("bwcTestSnapshots") {
if (project.bwc_tests_enabled) {
dependsOn tasks.matching { task -> BuildParams.bwcVersions.unreleased.any { version -> bwcTaskName(version) == task.name } }
}
}
tasks.register("bwcTest") {
description = 'Runs backwards compatibility tests.'
group = 'verification'
if (project.bwc_tests_enabled) {
dependsOn tasks.matching { it.name ==~ /v[0-9\.]+#bwcTest/ }
}
}
tasks.withType(Test).configureEach {
onlyIf { project.bwc_tests_enabled }
}
tasks.named("check").configure {
dependsOn(bwcTestSnapshots)
}
tasks.findByName("test")?.enabled = false