Skip to content

Commit 7f35dd9

Browse files
committed
Fix Gradle wrapper usage on Windows when building BWC (#28146)
Relates #28138
1 parent f018ba7 commit 7f35dd9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

distribution/bwc/build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
20+
import org.apache.tools.ant.taskdefs.condition.Os
2121
import org.elasticsearch.gradle.LoggedExec
2222
import org.elasticsearch.gradle.Version
2323
import java.util.regex.Matcher
@@ -118,7 +118,12 @@ if (project.hasProperty('bwcVersion')) {
118118
task buildBwcVersion(type: Exec) {
119119
dependsOn checkoutBwcBranch, writeBuildMetadata
120120
workingDir = checkoutDir
121-
executable = new File(checkoutDir, 'gradlew').toString()
121+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
122+
executable 'cmd'
123+
args '/C', 'call', new File(checkoutDir, 'gradlew').toString()
124+
} else {
125+
executable = new File(checkoutDir, 'gradlew').toString()
126+
}
122127
final ArrayList<String> commandLineArgs = [
123128
":distribution:deb:assemble",
124129
":distribution:rpm:assemble",
@@ -135,7 +140,7 @@ if (project.hasProperty('bwcVersion')) {
135140
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
136141
commandLineArgs << "--full-stacktrace"
137142
}
138-
args = commandLineArgs
143+
args commandLineArgs
139144
doLast {
140145
List missing = [bwcDeb, bwcRpm, bwcZip].grep { file ->
141146
false == file.exists()

0 commit comments

Comments
 (0)