From d69508d0bdafed83917866a041803dc86f40cf2a Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Wed, 8 Jan 2025 07:30:43 -0800 Subject: [PATCH] Provide better error message when attempting to run incompatible tests (#119699) --- .../src/main/groovy/elasticsearch.bwc-test.gradle | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.bwc-test.gradle b/build-tools-internal/src/main/groovy/elasticsearch.bwc-test.gradle index 77e509ea97870..db931c6ef0e83 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.bwc-test.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.bwc-test.gradle @@ -53,3 +53,14 @@ plugins.withType(InternalJavaRestTestPlugin) { tasks.matching { it.name.equals("check") }.configureEach { dependsOn(bwcTestSnapshots) } tasks.matching { it.name.equals("test") }.configureEach { enabled = false } + +tasks.addRule("incompatible bwc version") { taskName -> + def incompatible = buildParams.bwcVersions.allIndexCompatible - buildParams.bwcVersions.indexCompatible + if (incompatible.any { taskName.startsWith("v${it.toString()}") }) { + tasks.register(taskName) { + doLast { + throw new GradleException("Cannot execute task '$taskName'. Version is unsupported on this platform. Perhaps you need an x86 host?") + } + } + } +}