Use Gradle wrapper when building BWC
This commit modifies the BWC build to invoke the Gradle wrapper. The motivation for this is two-fold: - BWC versions might be dependent on a different version of Gradle than the current version of Gradle - in a follow-up we are going to need to be able to set JAVA_HOME to a different value than the current value of JAVA_HOME Relates #28138
This commit is contained in:
parent
1d1dcd4ae7
commit
a85772cbe5
|
@ -115,17 +115,34 @@ if (project.hasProperty('bwcVersion')) {
|
||||||
File bwcDeb = file("${checkoutDir}/distribution/deb/build/distributions/elasticsearch-${bwcVersion}.deb")
|
File bwcDeb = file("${checkoutDir}/distribution/deb/build/distributions/elasticsearch-${bwcVersion}.deb")
|
||||||
File bwcRpm = file("${checkoutDir}/distribution/rpm/build/distributions/elasticsearch-${bwcVersion}.rpm")
|
File bwcRpm = file("${checkoutDir}/distribution/rpm/build/distributions/elasticsearch-${bwcVersion}.rpm")
|
||||||
File bwcZip = file("${checkoutDir}/distribution/zip/build/distributions/elasticsearch-${bwcVersion}.zip")
|
File bwcZip = file("${checkoutDir}/distribution/zip/build/distributions/elasticsearch-${bwcVersion}.zip")
|
||||||
task buildBwcVersion(type: GradleBuild) {
|
task buildBwcVersion(type: Exec) {
|
||||||
dependsOn checkoutBwcBranch, writeBuildMetadata
|
dependsOn checkoutBwcBranch, writeBuildMetadata
|
||||||
dir = checkoutDir
|
workingDir = checkoutDir
|
||||||
tasks = [':distribution:deb:assemble', ':distribution:rpm:assemble', ':distribution:zip:assemble']
|
executable = new File(checkoutDir, 'gradlew').toString()
|
||||||
startParameter.systemPropertiesArgs = ['build.snapshot': System.getProperty("build.snapshot") ?: "true"]
|
final ArrayList<String> commandLineArgs = [
|
||||||
|
":distribution:deb:assemble",
|
||||||
|
":distribution:rpm:assemble",
|
||||||
|
":distribution:zip:assemble",
|
||||||
|
"-Dbuild.snapshot=${System.getProperty('build.snapshot') ?: 'true'}"]
|
||||||
|
final LogLevel logLevel = gradle.startParameter.logLevel
|
||||||
|
if ([LogLevel.QUIET, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG].contains(logLevel)) {
|
||||||
|
commandLineArgs << "--${logLevel.name().toLowerCase(Locale.ENGLISH)}"
|
||||||
|
}
|
||||||
|
final String showStacktraceName = gradle.startParameter.showStacktrace.name()
|
||||||
|
assert ["INTERNAL_EXCEPTIONS", "ALWAYS", "ALWAYS_FULL"].contains(showStacktraceName)
|
||||||
|
if (showStacktraceName.equals("ALWAYS")) {
|
||||||
|
commandLineArgs << "--stacktrace"
|
||||||
|
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
|
||||||
|
commandLineArgs << "--full-stacktrace"
|
||||||
|
}
|
||||||
|
args = commandLineArgs
|
||||||
doLast {
|
doLast {
|
||||||
List missing = [bwcDeb, bwcRpm, bwcZip].grep { file ->
|
List missing = [bwcDeb, bwcRpm, bwcZip].grep { file ->
|
||||||
false == file.exists() }
|
false == file.exists()
|
||||||
|
}
|
||||||
if (false == missing.empty) {
|
if (false == missing.empty) {
|
||||||
throw new InvalidUserDataException(
|
throw new InvalidUserDataException(
|
||||||
"Building bwc version didn't generate expected files ${missing}")
|
"Building bwc version didn't generate expected files ${missing}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue