Build: Remove legacy bwc files from xpack (#30485)

These bwc build files were leftover from before xpack was opened.
This commit is contained in:
Ryan Ernst 2018-05-10 22:23:02 -07:00 committed by GitHub
parent 6129d88e07
commit e9d898a7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 235 deletions

View File

@ -55,13 +55,4 @@ subprojects {
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-security:${version}": xpackModule('security')]
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-upgrade:${version}": xpackModule('upgrade')]
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-watcher:${version}": xpackModule('watcher')]
bwcVersions.snapshotProjectNames.each { snapshotName ->
Version snapshot = bwcVersions.getSnapshotForProject(snapshotName)
if (snapshot != null && snapshot.onOrAfter("6.3.0")) {
String snapshotProject = ":x-pack:plugin:bwc:${snapshotName}"
project(snapshotProject).ext.bwcVersion = snapshot
ext.projectSubstitutions["org.elasticsearch.plugin:x-pack:${snapshot}"] = snapshotProject
}
}
}

View File

@ -1,226 +0,0 @@
import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.test.NodeInfo
import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
/**
* Subdirectories of this project are dummy projects which does a local
* checkout of the appropriate version's branch, and builds a snapshot. This
* allows backcompat tests to test against the next unreleased versions
* without relying on snapshots.
*/
subprojects {
Version bwcVersion = bwcVersions.getSnapshotForProject(project.name)
if (bwcVersion == null) {
// this project wont do anything
return
}
String bwcBranch
if (project.name == 'next-minor-snapshot') {
// this is always a .x series
bwcBranch = "${bwcVersion.major}.x"
} else {
bwcBranch = "${bwcVersion.major}.${bwcVersion.minor}"
}
apply plugin: 'distribution'
// Not published so no need to assemble
tasks.remove(assemble)
build.dependsOn.remove('assemble')
File esCheckoutDir = file("${buildDir}/bwc/checkout-es-${bwcBranch}")
/* Delay building the path as the path will not exist during configuration which will
* fail on Windows due to getting the short name requiring the path to already exist.
*/
Object esCheckoutPath = """${->
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
esCheckoutDir.mkdirs()
NodeInfo.getShortPathName(esCheckoutDir.toString())
} else {
esCheckoutDir.toString()
}
}"""
File xpackCheckoutDir = file("${esCheckoutDir}-extra/x-pack-elasticsearch")
Object xpackCheckoutPath = """${->
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
xpackCheckoutDir.mkdirs()
NodeInfo.getShortPathName(xpackCheckoutDir.toString())
} else {
xpackCheckoutDir.toString()
}
}"""
final String remote = System.getProperty("tests.bwc.remote", "elastic")
task createElasticsearchClone(type: LoggedExec) {
onlyIf { esCheckoutDir.exists() == false }
commandLine = ['git', 'clone', rootDir, esCheckoutPath]
}
task createXPackClone(type: LoggedExec) {
onlyIf { xpackCheckoutDir.exists() == false }
commandLine = ['git', 'clone', xpackRootProject.projectDir, xpackCheckoutPath]
}
// we use regular Exec here to ensure we always get output, regardless of logging level
task findElasticsearchRemote(type: Exec) {
dependsOn createElasticsearchClone
workingDir = esCheckoutDir
commandLine = ['git', 'remote', '-v']
ignoreExitValue = true
ByteArrayOutputStream output = new ByteArrayOutputStream()
standardOutput = output
doLast {
if (execResult.exitValue != 0) {
output.toString('UTF-8').eachLine { line -> logger.error(line) }
execResult.assertNormalExitValue()
}
project.ext.esRemoteExists = false
output.toString('UTF-8').eachLine {
if (it.contains("${remote}\t")) {
project.ext.esRemoteExists = true
}
}
}
}
task findXPackRemote(type: Exec) {
dependsOn createXPackClone
workingDir = xpackCheckoutDir
commandLine = ['git', 'remote', '-v']
ignoreExitValue = true
ByteArrayOutputStream output = new ByteArrayOutputStream()
standardOutput = output
doLast {
if (execResult.exitValue != 0) {
output.toString('UTF-8').eachLine { line -> logger.error(line) }
execResult.assertNormalExitValue()
}
project.ext.xpackRemoteExists = false
output.toString('UTF-8').eachLine {
if (it.contains("${remote}\t")) {
project.ext.xpackRemoteExists = true
}
}
}
}
task addElasticsearchRemote(type: LoggedExec) {
dependsOn findElasticsearchRemote
onlyIf { project.ext.esRemoteExists == false }
workingDir = esCheckoutDir
commandLine = ['git', 'remote', 'add', "${remote}", "git@github.com:${remote}/elasticsearch.git"]
}
task addXPackRemote(type: LoggedExec) {
dependsOn findXPackRemote
onlyIf { project.ext.xpackRemoteExists == false }
workingDir = xpackCheckoutDir
commandLine = ['git', 'remote', 'add', "${remote}", "git@github.com:${remote}/x-pack-elasticsearch.git"]
}
task fetchElasticsearchLatest(type: LoggedExec) {
dependsOn addElasticsearchRemote
workingDir = esCheckoutDir
commandLine = ['git', 'fetch', '--all']
}
task fetchXPackLatest(type: LoggedExec) {
dependsOn addXPackRemote
workingDir = xpackCheckoutDir
commandLine = ['git', 'fetch', '--all']
}
String esBuildMetadataKey = "bwc_refspec_${project.path.substring(1)}_elasticsearch"
task checkoutElasticsearchBwcBranch(type: LoggedExec) {
dependsOn fetchElasticsearchLatest
def String refspec = System.getProperty("tests.bwc.refspec", buildMetadata.get(esBuildMetadataKey, "${remote}/${bwcBranch}"))
workingDir = esCheckoutDir
commandLine = ['git', 'checkout', refspec]
}
String xpackBuildMetadataKey = "bwc_refspec_${project.path.substring(1)}_xpack"
task checkoutXPackBwcBranch(type: LoggedExec) {
dependsOn fetchXPackLatest
def String refspec = System.getProperty("tests.bwc.refspec", buildMetadata.get(xpackBuildMetadataKey, "${remote}/${bwcBranch}"))
workingDir = xpackCheckoutDir
commandLine = ['git', 'checkout', refspec]
}
File esBuildMetadataFile = project.file("build/${project.name}_elasticsearch/build_metadata")
task writeElasticsearchBuildMetadata(type: LoggedExec) {
dependsOn checkoutElasticsearchBwcBranch
workingDir = esCheckoutDir
commandLine = ['git', 'rev-parse', 'HEAD']
ignoreExitValue = true
ByteArrayOutputStream output = new ByteArrayOutputStream()
standardOutput = output
doLast {
if (execResult.exitValue != 0) {
output.toString('UTF-8').eachLine { line -> logger.error(line) }
execResult.assertNormalExitValue()
}
project.mkdir(esBuildMetadataFile.parent)
esBuildMetadataFile.setText("${esBuildMetadataKey}=${output.toString('UTF-8')}", 'UTF-8')
}
}
File xpackBuildMetadataFile = project.file("build/${project.name}_xpack/build_metadata")
task writeXPackBuildMetadata(type: LoggedExec) {
dependsOn checkoutXPackBwcBranch
workingDir = xpackCheckoutDir
commandLine = ['git', 'rev-parse', 'HEAD']
ignoreExitValue = true
ByteArrayOutputStream output = new ByteArrayOutputStream()
standardOutput = output
doLast {
if (execResult.exitValue != 0) {
output.toString('UTF-8').eachLine { line -> logger.error(line) }
execResult.assertNormalExitValue()
}
project.mkdir(xpackBuildMetadataFile.parent)
xpackBuildMetadataFile.setText("${xpackBuildMetadataKey}=${output.toString('UTF-8')}", 'UTF-8')
}
}
File bwcZip = file("${xpackCheckoutDir}/plugin/build/distributions/x-pack-${bwcVersion}.zip")
task buildBwcVersion(type: Exec) {
dependsOn checkoutXPackBwcBranch, checkoutElasticsearchBwcBranch, writeElasticsearchBuildMetadata, writeXPackBuildMetadata
workingDir = xpackCheckoutDir
if (["5.6", "6.0", "6.1"].contains(bwcBranch)) {
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
environment('JAVA_HOME', getJavaHome(it, 8))
} else if ("6.2".equals(bwcBranch)) {
environment('JAVA_HOME', getJavaHome(it, 9))
} else {
environment('JAVA_HOME', project.compilerJavaHome)
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
executable 'cmd'
args '/C', 'call', new File(xpackCheckoutDir, 'gradlew').toString()
} else {
executable new File(xpackCheckoutDir, 'gradlew').toString()
}
args ":x-pack-elasticsearch:plugin:assemble", "-Dbuild.snapshot=true"
final LogLevel logLevel = gradle.startParameter.logLevel
if ([LogLevel.QUIET, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG].contains(logLevel)) {
args "--${logLevel.name().toLowerCase(Locale.ENGLISH)}"
}
final String showStacktraceName = gradle.startParameter.showStacktrace.name()
assert ["INTERNAL_EXCEPTIONS", "ALWAYS", "ALWAYS_FULL"].contains(showStacktraceName)
if (showStacktraceName.equals("ALWAYS")) {
args "--stacktrace"
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
args "--full-stacktrace"
}
}
artifacts {
'default' file: bwcZip, name: 'x-pack', type: 'zip', builtBy: buildBwcVersion
}
}