mirror of
https://github.com/elastic/logstash.git
synced 2025-04-19 20:27:23 -04:00
539 lines
20 KiB
Groovy
539 lines
20 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url 'https://plugins.gradle.org/m2/'
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'org.yaml:snakeyaml:1.23'
|
|
classpath "gradle.plugin.com.github.jk1:gradle-license-report:0.7.1"
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id "de.undercouch.download" version "3.2.0"
|
|
}
|
|
|
|
apply plugin: 'de.undercouch.download'
|
|
|
|
|
|
import de.undercouch.gradle.tasks.download.Download
|
|
import de.undercouch.gradle.tasks.download.Verify
|
|
import groovy.json.JsonSlurper
|
|
import org.logstash.gradle.RubyGradleUtils
|
|
import org.yaml.snakeyaml.Yaml
|
|
|
|
import java.nio.file.Files
|
|
import java.nio.file.Paths
|
|
|
|
allprojects {
|
|
group = 'org.logstash'
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'idea'
|
|
|
|
project.sourceCompatibility = JavaVersion.VERSION_1_8
|
|
project.targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
tasks.withType(JavaCompile).all {
|
|
options.compilerArgs.add("-Xlint:all")
|
|
options.compilerArgs.add("-Xlint:-processing")
|
|
options.compilerArgs.add("-Werror")
|
|
}
|
|
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption("Xwerror", "-quiet")
|
|
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) > 0) {
|
|
options.addBooleanOption("html5", true)
|
|
}
|
|
}
|
|
|
|
clean {
|
|
delete "${projectDir}/out/"
|
|
}
|
|
|
|
//https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time
|
|
tasks.withType(Test) {
|
|
testLogging {
|
|
// set options for log level LIFECYCLE
|
|
events "passed", "skipped", "failed", "standardOut"
|
|
showExceptions true
|
|
exceptionFormat "full"
|
|
showCauses true
|
|
showStackTraces true
|
|
enableAssertions false
|
|
|
|
// set options for log level DEBUG and INFO
|
|
debug {
|
|
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
|
exceptionFormat "full"
|
|
}
|
|
info.events = debug.events
|
|
info.exceptionFormat = debug.exceptionFormat
|
|
|
|
afterSuite { desc, result ->
|
|
if (!desc.parent) { // will match the outermost suite
|
|
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
|
|
def startItem = '| ', endItem = ' |'
|
|
def repeatLength = startItem.length() + output.length() + endItem.length()
|
|
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
repositories {
|
|
maven {
|
|
url 'https://plugins.gradle.org/m2/'
|
|
}
|
|
}
|
|
dependencies {
|
|
compile "gradle.plugin.com.github.jk1:gradle-license-report:0.7.1"
|
|
}
|
|
|
|
apply plugin: 'com.github.jk1.dependency-license-report'
|
|
|
|
licenseReport {
|
|
renderer = new com.github.jk1.license.render.CsvReportRenderer()
|
|
configurations = ['compile', 'runtime']
|
|
}
|
|
}
|
|
|
|
// fetch version from Logstash's master versions.yml file
|
|
def versionMap = (Map) (new Yaml()).load(new File("${projectDir}/versions.yml").text)
|
|
version = versionMap['logstash-core']
|
|
def versionQualifier = System.getenv('VERSION_QUALIFIER')
|
|
if (versionQualifier) {
|
|
version = "$version-$versionQualifier"
|
|
}
|
|
// a release build will try to download the exact version artifact and not append -SNAPSHOT to it see
|
|
// the downloadEs task below
|
|
def isReleaseBuild = System.getenv('RELEASE') == "1" || versionQualifier
|
|
|
|
String jRubyURL
|
|
String jRubyVersion
|
|
String jRubySha1
|
|
Boolean doChecksum
|
|
|
|
if (versionMap["jruby-runtime-override"]) {
|
|
jRubyVersion = versionMap["jruby-runtime-override"]["version"]
|
|
jRubyURL = versionMap["jruby-runtime-override"]["url"]
|
|
doChecksum = false
|
|
} else {
|
|
jRubyVersion = versionMap["jruby"]["version"]
|
|
jRubySha1 = versionMap["jruby"]["sha1"]
|
|
jRubyURL = "https://repo1.maven.org/maven2/org/jruby/jruby-dist/${jRubyVersion}/jruby-dist-${jRubyVersion}-bin.tar.gz"
|
|
doChecksum = true
|
|
}
|
|
|
|
// Tasks
|
|
|
|
clean {
|
|
delete "${projectDir}/Gemfile"
|
|
delete "${projectDir}/Gemfile.lock"
|
|
delete "${projectDir}/vendor"
|
|
delete "${projectDir}/.bundle"
|
|
delete "${projectDir}/qa/integration/Gemfile.lock"
|
|
delete "${projectDir}/qa/integration/.bundle"
|
|
delete "${projectDir}/build/licenseReportFolders.txt"
|
|
delete "${projectDir}/build/rubyDependencies.csv"
|
|
}
|
|
|
|
task bootstrap {}
|
|
|
|
RubyGradleUtils rubyGradleUtils = new RubyGradleUtils(buildDir, projectDir)
|
|
|
|
project(":logstash-core") {
|
|
["rubyTests", "test"].each { tsk ->
|
|
tasks.getByPath(":logstash-core:" + tsk).configure {
|
|
dependsOn bootstrap
|
|
}
|
|
}
|
|
}
|
|
|
|
def jrubyTarPath = "${projectDir}/vendor/_/jruby-dist-${jRubyVersion}-bin.tar.gz"
|
|
|
|
def customJRubyDir = project.hasProperty("custom.jruby.path") ? project.property("custom.jruby.path") : ""
|
|
def customJRubyVersion = customJRubyDir == "" ? "" : Files.readAllLines(Paths.get(customJRubyDir, "VERSION")).get(0).trim()
|
|
def customJRubyTar = customJRubyDir == "" ? "" : (customJRubyDir + "/maven/jruby-dist/target/jruby-dist-${customJRubyVersion}-bin.tar.gz")
|
|
|
|
task downloadJRuby(type: Download) {
|
|
description "Download JRuby artifact from this specific URL: ${jRubyURL}"
|
|
src jRubyURL
|
|
onlyIfNewer true
|
|
inputs.file("${projectDir}/versions.yml")
|
|
outputs.file(jrubyTarPath)
|
|
dest new File("${projectDir}/vendor/_", "jruby-dist-${jRubyVersion}-bin.tar.gz")
|
|
}
|
|
|
|
downloadJRuby.onlyIf { customJRubyDir == "" }
|
|
|
|
task verifyFile(dependsOn: downloadJRuby, type: Verify) {
|
|
description "Verify the SHA1 of the download JRuby artifact"
|
|
inputs.file(jrubyTarPath)
|
|
outputs.file(jrubyTarPath)
|
|
src new File(jrubyTarPath)
|
|
algorithm 'SHA-1'
|
|
checksum jRubySha1
|
|
}
|
|
|
|
verifyFile.onlyIf { customJRubyDir == "" }
|
|
|
|
task buildCustomJRuby(type: Exec) {
|
|
description "Build tar.gz and .jar artifacts from JRuby source directory"
|
|
workingDir (customJRubyDir == "" ? "./" : customJRubyDir)
|
|
commandLine './mvnw', 'clean', 'install', '-Pdist', '-Pcomplete'
|
|
standardOutput = new ByteArrayOutputStream()
|
|
errorOutput = new ByteArrayOutputStream()
|
|
ext.output = {
|
|
standardOutput.toString() + errorOutput.toString()
|
|
}
|
|
}
|
|
|
|
buildCustomJRuby.onlyIf { customJRubyDir != "" }
|
|
|
|
task installCustomJRuby(dependsOn: buildCustomJRuby, type: Copy) {
|
|
description "Install custom built JRuby in the vendor directory"
|
|
inputs.file(customJRubyTar)
|
|
outputs.dir("${projectDir}/vendor/jruby")
|
|
from tarTree(customJRubyTar == "" ? jrubyTarPath : customJRubyTar)
|
|
eachFile { f ->
|
|
f.path = f.path.replaceFirst("^jruby-${customJRubyVersion}", '')
|
|
}
|
|
exclude "**/stdlib/rdoc/**"
|
|
includeEmptyDirs = false
|
|
into "${projectDir}/vendor/jruby"
|
|
}
|
|
|
|
installCustomJRuby.onlyIf { customJRubyDir != "" }
|
|
|
|
task downloadAndInstallJRuby(dependsOn: [verifyFile, installCustomJRuby], type: Copy) {
|
|
description "Install JRuby in the vendor directory"
|
|
inputs.file(jrubyTarPath)
|
|
outputs.dir("${projectDir}/vendor/jruby")
|
|
from tarTree(downloadJRuby.dest)
|
|
eachFile { f ->
|
|
f.path = f.path.replaceFirst("^jruby-${jRubyVersion}", '')
|
|
}
|
|
exclude "**/stdlib/rdoc/**"
|
|
exclude "**/stdlib/bundler/**"
|
|
exclude "**/stdlib/bundler.rb"
|
|
exclude "**/bundler-1.16.6/**"
|
|
exclude "**/bundler-1.16.6.*"
|
|
|
|
includeEmptyDirs = false
|
|
into "${projectDir}/vendor/jruby"
|
|
doLast {
|
|
rubyGradleUtils.gem("rake", "12.3.1", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
rubyGradleUtils.gem("json", "1.8.6", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
}
|
|
}
|
|
|
|
downloadAndInstallJRuby.onlyIf { customJRubyDir == "" }
|
|
|
|
task installDefaultGems(dependsOn: downloadAndInstallJRuby) {
|
|
inputs.files file("${projectDir}/Gemfile.template")
|
|
inputs.files fileTree("${projectDir}/rakelib")
|
|
inputs.files file("${projectDir}/versions.yml")
|
|
outputs.file("${projectDir}/Gemfile")
|
|
outputs.file("${projectDir}/Gemfile.lock")
|
|
outputs.dir("${projectDir}/logstash-core/lib/jars")
|
|
outputs.dir("${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
doLast {
|
|
rubyGradleUtils.gem("rake", "12.3.1", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
rubyGradleUtils.gem("json", "1.8.6", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
rubyGradleUtils.rake('plugin:install-default')
|
|
}
|
|
}
|
|
|
|
def assemblyDeps = [downloadAndInstallJRuby, assemble] + subprojects.collect {
|
|
it.tasks.findByName("assemble")
|
|
}
|
|
|
|
task installTestGems(dependsOn: assemblyDeps) {
|
|
inputs.files file("${projectDir}/Gemfile.template")
|
|
inputs.files fileTree("${projectDir}/rakelib")
|
|
inputs.files file("${projectDir}/versions.yml")
|
|
outputs.file("${projectDir}/Gemfile")
|
|
outputs.file("${projectDir}/Gemfile.lock")
|
|
outputs.dir("${projectDir}/logstash-core/lib/jars")
|
|
outputs.dir("${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
doLast {
|
|
rubyGradleUtils.gem("rake", "12.3.1", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
rubyGradleUtils.gem("json", "1.8.6", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
rubyGradleUtils.rake('plugin:install-development-dependencies')
|
|
}
|
|
}
|
|
|
|
task assembleTarDistribution(dependsOn: assemblyDeps) {
|
|
inputs.files fileTree("${projectDir}/rakelib")
|
|
inputs.files fileTree("${projectDir}/bin")
|
|
inputs.files fileTree("${projectDir}/config")
|
|
inputs.files fileTree("${projectDir}/lib")
|
|
inputs.files fileTree("${projectDir}/modules")
|
|
inputs.files fileTree("${projectDir}/logstash-core-plugin-api")
|
|
inputs.files fileTree("${projectDir}/logstash-core/lib")
|
|
inputs.files fileTree("${projectDir}/logstash-core/src")
|
|
inputs.files fileTree("${projectDir}/x-pack")
|
|
outputs.files file("${buildDir}/logstash-${project.version}-SNAPSHOT.tar.gz")
|
|
doLast {
|
|
rubyGradleUtils.gem("rake", "12.3.1", "${projectDir}/vendor/bundle/jruby/2.5.0")
|
|
rubyGradleUtils.rake('artifact:tar')
|
|
}
|
|
}
|
|
|
|
task assembleOssTarDistribution(dependsOn: assemblyDeps) {
|
|
inputs.files fileTree("${projectDir}/rakelib")
|
|
inputs.files fileTree("${projectDir}/bin")
|
|
inputs.files fileTree("${projectDir}/config")
|
|
inputs.files fileTree("${projectDir}/lib")
|
|
inputs.files fileTree("${projectDir}/modules")
|
|
inputs.files fileTree("${projectDir}/logstash-core-plugin-api")
|
|
inputs.files fileTree("${projectDir}/logstash-core/lib")
|
|
inputs.files fileTree("${projectDir}/logstash-core/src")
|
|
doLast {
|
|
rubyGradleUtils.rake('artifact:tar_oss')
|
|
}
|
|
}
|
|
|
|
task assembleZipDistribution(dependsOn: assemblyDeps) {
|
|
inputs.files fileTree("${projectDir}/rakelib")
|
|
inputs.files fileTree("${projectDir}/bin")
|
|
inputs.files fileTree("${projectDir}/config")
|
|
inputs.files fileTree("${projectDir}/lib")
|
|
inputs.files fileTree("${projectDir}/modules")
|
|
inputs.files fileTree("${projectDir}/logstash-core-plugin-api")
|
|
inputs.files fileTree("${projectDir}/logstash-core/lib")
|
|
inputs.files fileTree("${projectDir}/logstash-core/src")
|
|
inputs.files fileTree("${projectDir}/x-pack")
|
|
outputs.files file("${buildDir}/logstash-${project.version}.zip")
|
|
doLast {
|
|
rubyGradleUtils.rake('artifact:zip')
|
|
}
|
|
}
|
|
|
|
task assembleOssZipDistribution(dependsOn: assemblyDeps) {
|
|
inputs.files fileTree("${projectDir}/rakelib")
|
|
inputs.files fileTree("${projectDir}/bin")
|
|
inputs.files fileTree("${projectDir}/config")
|
|
inputs.files fileTree("${projectDir}/lib")
|
|
inputs.files fileTree("${projectDir}/modules")
|
|
inputs.files fileTree("${projectDir}/logstash-core-plugin-api")
|
|
inputs.files fileTree("${projectDir}/logstash-core/lib")
|
|
inputs.files fileTree("${projectDir}/logstash-core/src")
|
|
outputs.files file("${buildDir}/logstash-${project.version}.zip")
|
|
doLast {
|
|
rubyGradleUtils.rake('artifact:zip_oss')
|
|
}
|
|
}
|
|
|
|
def logstashBuildDir = "${buildDir}/logstash-${project.version}-SNAPSHOT"
|
|
|
|
task unpackTarDistribution(dependsOn: assembleTarDistribution, type: Copy) {
|
|
def tar = file("${buildDir}/logstash-${project.version}-SNAPSHOT.tar.gz")
|
|
inputs.files tar
|
|
outputs.files fileTree(logstashBuildDir)
|
|
from tarTree(tar)
|
|
into {buildDir}
|
|
}
|
|
|
|
def qaVendorPath = "${buildDir}/qa/integration/vendor"
|
|
def qaBundledGemPath = "${qaVendorPath}/jruby/2.5.0"
|
|
def qaBundleBin = "${qaBundledGemPath}/bin/bundle"
|
|
|
|
task installIntegrationTestBundler(dependsOn: unpackTarDistribution) {
|
|
outputs.files fileTree("${qaBundledGemPath}/gems/bundler-1.17.3")
|
|
doLast {
|
|
rubyGradleUtils.gem("bundler", "1.17.3", qaBundledGemPath)
|
|
}
|
|
}
|
|
|
|
task installIntegrationTestGems(dependsOn: installIntegrationTestBundler) {
|
|
inputs.files file("${projectDir}/qa/integration/Gemfile")
|
|
inputs.files file("${projectDir}/qa/integration/integration_tests.gemspec")
|
|
inputs.files file("${logstashBuildDir}/Gemfile")
|
|
inputs.files file("${logstashBuildDir}/Gemfile.lock")
|
|
inputs.files file("${logstashBuildDir}/logstash-core/logstash-core.gemspec")
|
|
outputs.files fileTree("${qaVendorPath}")
|
|
outputs.files file("${projectDir}/qa/integration/Gemfile.lock")
|
|
doLast {
|
|
rubyGradleUtils.bundle(
|
|
"${projectDir}/qa/integration", qaBundleBin, ['install', '--path', qaVendorPath],
|
|
[LS_GEM_PATH: qaBundledGemPath, LS_GEM_HOME: qaBundledGemPath]
|
|
)
|
|
}
|
|
}
|
|
|
|
def rubyIntegrationSpecs = project.hasProperty("rubyIntegrationSpecs") ? ((String) project.property("rubyIntegrationSpecs")).split(/\s+/).join(",") : "specs/**/*_spec.rb"
|
|
def integrationTestPwd = "${projectDir}/qa/integration"
|
|
|
|
project(":logstash-integration-tests") {
|
|
tasks.getByPath(":logstash-integration-tests:integrationTests").configure {
|
|
systemProperty 'org.logstash.integration.specs', rubyIntegrationSpecs
|
|
environment "FEATURE_FLAG", System.getenv('FEATURE_FLAG')
|
|
workingDir integrationTestPwd
|
|
dependsOn installIntegrationTestGems
|
|
}
|
|
}
|
|
|
|
task runIntegrationTests(dependsOn: [tasks.getByPath(":logstash-integration-tests:integrationTests")]) {}
|
|
|
|
task generateLicenseReport(type: JavaExec) {
|
|
dependsOn("generateLicenseReportInputs")
|
|
dependsOn(":dependencies-report:assemble")
|
|
|
|
def jarFile = project('dependencies-report').getBuildDir().toString() + "/libs/dependencies-report.jar"
|
|
|
|
String licenseReportInputCSV = project.hasProperty("licenseReportInputCSV") ? project.property("licenseReportInputCSV") : "build/dependencies.csv.ruby"
|
|
String licenseReportOutputCSV = project.hasProperty("licenseReportOutputCSV") ? project.property("licenseReportOutputCSV") : "build/dependencies.csv"
|
|
String noticePath = "NOTICE.txt"
|
|
|
|
classpath = project.files([jarFile])
|
|
main = "org.logstash.dependencies.Main"
|
|
args licenseReportInputCSV,
|
|
project.getBuildDir().toString() + "/licenseReportFolders.txt",
|
|
licenseReportOutputCSV, noticePath
|
|
}
|
|
|
|
task generateLicenseReportInputs() {
|
|
dependsOn subprojects.generateLicenseReport
|
|
|
|
// write location of all license reports for subprojects containing artifacts that are distributed to single file
|
|
StringBuilder licenseReportFolders = new StringBuilder()
|
|
subprojects.findAll { s1 -> !s1.hasProperty("isDistributedArtifact") || s1.property("isDistributedArtifact") == 'true'}.each { s ->
|
|
s.tasks.findAll { t2 -> t2.getName() == "generateLicenseReport" }.each { t3 ->
|
|
licenseReportFolders.append(t3.outputs.files.asPath + "\n")
|
|
}
|
|
}
|
|
|
|
if (gradle.startParameter.taskNames.contains("generateLicenseReport")) {
|
|
def licenseReportPath = project.getBuildDir().toString() + "/licenseReportFolders.txt"
|
|
def licenseReportFolder = new File(licenseReportPath)
|
|
licenseReportFolder.delete()
|
|
licenseReportFolder = new File(licenseReportPath)
|
|
licenseReportFolder.createNewFile()
|
|
if (licenseReportFolder.canWrite()) {
|
|
licenseReportFolder.text = licenseReportFolders.toString()
|
|
}
|
|
}
|
|
}
|
|
|
|
task generatePluginsVersion(dependsOn: bootstrap) {
|
|
doLast {
|
|
rubyGradleUtils.rake('generate_plugins_version')
|
|
}
|
|
}
|
|
|
|
// If you are running a JRuby snapshot we will skip the integrity check.
|
|
verifyFile.onlyIf { doChecksum }
|
|
bootstrap.dependsOn installTestGems
|
|
|
|
runIntegrationTests.shouldRunAfter tasks.getByPath(":logstash-core:test")
|
|
check.dependsOn runIntegrationTests
|
|
|
|
String artifactsVersionApi = "https://artifacts-api.elastic.co/v1/versions/"
|
|
|
|
task downloadEs(type: Download) {
|
|
description "Download ES Snapshot for current branch version: ${version}"
|
|
|
|
doFirst {
|
|
if (!project.ext.versionFound) {
|
|
throw new GradleException("could not find the current artifact from the artifact-api ${artifactsVersionApi} for " + (isReleaseBuild ? "release" : "snapshot") + " version: ${version}")
|
|
}
|
|
}
|
|
|
|
String apiResponse = artifactsVersionApi.toURL().text
|
|
def dlVersions = new JsonSlurper().parseText(apiResponse)
|
|
// the version string can be either '7.0.0' or '7.0.0-alpha1', i.e. with the qualifier.
|
|
// in the normal PR type builds it is plain '7.0.0'
|
|
// in the build invoked by the release manager it is '7.0.0-alpha1' etc.
|
|
// the artifacts-api will return JSON like this: `{"versions":["5.6.13-SNAPSHOT","6.4.3-SNAPSHOT","6.5.0-SNAPSHOT","6.6.0-SNAPSHOT","7.0.0-alpha1-SNAPSHOT"]}`
|
|
|
|
String qualifiedVersion = dlVersions['versions'].grep(isReleaseBuild ? ~/^${version}$/ : ~/^${version}-SNAPSHOT/)[0]
|
|
|
|
if (qualifiedVersion == null) {
|
|
// the version is not found in the versions API, for now just set dummy values so the
|
|
// task parameters like src and dest below sees these dummy values but also set
|
|
// versionFound to false so that we can fail the task in the doFirst closure.
|
|
// this is somewhat convoluted and there is certainly a better way to do this but
|
|
// it seems to be an acceptable solution for now.
|
|
project.ext.set("versionFound", false)
|
|
project.ext.set("elasticsearchSnapshotURL", "http://elastic.co/invalid")
|
|
project.ext.set("elasticsearchDownloadLocation", "${projectDir}/build/invalid")
|
|
} else {
|
|
project.ext.set("versionFound", true)
|
|
|
|
String arch = "x86_64"
|
|
String osName = System.properties['os.name']
|
|
|
|
if (osName ==~ /Mac OS X/) {
|
|
osName = "darwin"
|
|
} else {
|
|
osName = "linux"
|
|
}
|
|
|
|
String architecture = "${osName}-${arch}"
|
|
|
|
String downloadedElasticsearchName = "elasticsearch-${qualifiedVersion}-${architecture}"
|
|
project.ext.set("unpackedElasticsearchName", "elasticsearch-${qualifiedVersion}")
|
|
|
|
// find latest reference to last build
|
|
String buildsListApi = "https://artifacts-api.elastic.co/v1/versions/${qualifiedVersion}/builds/"
|
|
apiResponse = buildsListApi.toURL().text
|
|
def dlBuilds = new JsonSlurper().parseText(apiResponse)
|
|
String build = dlBuilds["builds"][0]
|
|
|
|
// find url of build artifact
|
|
String artifactApiUrl = "https://artifacts-api.elastic.co/v1/versions/${qualifiedVersion}/builds/${build}/projects/elasticsearch/packages/${downloadedElasticsearchName}.tar.gz"
|
|
apiResponse = artifactApiUrl.toURL().text
|
|
def buildUrls = new JsonSlurper().parseText(apiResponse)
|
|
|
|
project.ext.set("elasticsearchSnapshotURL", System.getenv("ELASTICSEARCH_SNAPSHOT_URL") ?: buildUrls["package"]["url"])
|
|
project.ext.set("elasticsearchDownloadLocation", "${projectDir}/build/${downloadedElasticsearchName}.tar.gz")
|
|
}
|
|
|
|
src project.ext.elasticsearchSnapshotURL
|
|
onlyIfNewer true
|
|
inputs.file("${projectDir}/versions.yml")
|
|
outputs.file(project.ext.elasticsearchDownloadLocation)
|
|
dest new File(project.ext.elasticsearchDownloadLocation)
|
|
|
|
doLast {
|
|
System.out.println "Downloaded to ${project.ext.elasticsearchDownloadLocation}"
|
|
}
|
|
}
|
|
|
|
task deleteLocalEs(type: Delete) {
|
|
delete ('./build/elasticsearch')
|
|
}
|
|
|
|
task copyEs(type: Copy, dependsOn: [downloadEs, deleteLocalEs]) {
|
|
from tarTree(resources.gzip(project.ext.elasticsearchDownloadLocation))
|
|
into "./build/"
|
|
|
|
doLast {
|
|
file("./build/${project.ext.unpackedElasticsearchName}").renameTo('./build/elasticsearch')
|
|
System.out.println "Unzipped ${project.ext.elasticsearchDownloadLocation} to ./build/elasticsearch"
|
|
}
|
|
}
|
|
|
|
Boolean oss = System.getenv('OSS').equals('true')
|
|
|
|
if (!oss) {
|
|
project(":logstash-xpack") {
|
|
["rubyTests", "rubyIntegrationTests", "test"].each { tsk ->
|
|
tasks.getByPath(":logstash-xpack:" + tsk).configure {
|
|
dependsOn bootstrap
|
|
}
|
|
}
|
|
tasks.getByPath(":logstash-xpack:rubyIntegrationTests").configure {
|
|
dependsOn copyEs
|
|
}
|
|
}
|
|
|
|
task runXPackUnitTests(dependsOn: [tasks.getByPath(":logstash-xpack:rubyTests")]) {}
|
|
task runXPackIntegrationTests(dependsOn: [tasks.getByPath(":logstash-xpack:rubyIntegrationTests")]) {}
|
|
}
|