From 85f6a82482b9c94b0b94853dfecc38e3fb7a2049 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Wed, 8 Jan 2025 08:48:42 -0800 Subject: [PATCH] Provide better error message when attempting to run incompatible tests (#119699) (#119767) --- .../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?") + } + } + } +}