From 82da56c9762fc02e4563851ec2054f9097299aed Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Tue, 9 Jan 2018 11:58:16 +0100 Subject: [PATCH] Fix Gradle wrapper usage on Windows when building BWC (#28146) Relates #28138 --- distribution/bwc/build.gradle | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/distribution/bwc/build.gradle b/distribution/bwc/build.gradle index 4c6323c337e..93f6ffe2c9b 100644 --- a/distribution/bwc/build.gradle +++ b/distribution/bwc/build.gradle @@ -17,7 +17,7 @@ * under the License. */ - +import org.apache.tools.ant.taskdefs.condition.Os import org.elasticsearch.gradle.LoggedExec import org.elasticsearch.gradle.Version import java.util.regex.Matcher @@ -118,7 +118,12 @@ if (project.hasProperty('bwcVersion')) { task buildBwcVersion(type: Exec) { dependsOn checkoutBwcBranch, writeBuildMetadata workingDir = checkoutDir - executable = new File(checkoutDir, 'gradlew').toString() + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + executable 'cmd' + args '/C', 'call', new File(checkoutDir, 'gradlew').toString() + } else { + executable = new File(checkoutDir, 'gradlew').toString() + } final ArrayList commandLineArgs = [ ":distribution:deb:assemble", ":distribution:rpm:assemble", @@ -135,7 +140,7 @@ if (project.hasProperty('bwcVersion')) { } else if (showStacktraceName.equals("ALWAYS_FULL")) { commandLineArgs << "--full-stacktrace" } - args = commandLineArgs + args commandLineArgs doLast { List missing = [bwcDeb, bwcRpm, bwcZip].grep { file -> false == file.exists()