Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 78 additions & 58 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildscript {
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
url = 'https://plugins.gradle.org/m2/'
}
}
}
Expand Down Expand Up @@ -103,16 +103,16 @@ allprojects {
testLogging {
// set options for log level LIFECYCLE
events "passed", "skipped", "failed", "standardOut"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
enableAssertions false
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"
exceptionFormat = "full"
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
Expand All @@ -133,7 +133,7 @@ subprojects {
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
url = 'https://plugins.gradle.org/m2/'
}
}

Expand Down Expand Up @@ -165,8 +165,9 @@ tasks.register("configureArchitecture") {

tasks.register("configureArtifactInfo") {
dependsOn configureArchitecture
description "Set the url to download stack artifacts for select stack version"
description = "Set the url to download stack artifacts for select stack version"

def projectRef = project
doLast {
def splitVersion = version.split('\\.')
int major = splitVersion[0].toInteger()
Expand All @@ -189,28 +190,28 @@ tasks.register("configureArtifactInfo") {
}
}

project.ext.set("artifactApiVersion", qualifiedVersion)
projectRef.ext.set("artifactApiVersion", qualifiedVersion)
}
}

tasks.register("markAliasDefinitions", SignAliasDefinitions) {
description "Create an hashes aliases file from original aliases yml definition"
description = "Create an hashes aliases file from original aliases yml definition"
hashedFile = project.file("${project.buildDir}/plugin_aliases_hashed.yml")
}

tasks.register("markTestAliasDefinitions", SignAliasDefinitions) {
description "Create an hashes aliases file for testing aliases yml definition"
description = "Create an hashes aliases file for testing aliases yml definition"
stage SignAliasDefinitions.Stage.test
hashedFile = project.file("${project.buildDir}/plugin_aliases_hashed_test.yml")
}

tasks.register("copyPluginAlias", Copy) {
description "Copy the marked plugin_aliases.yml file to destination folders"
description = "Copy the marked plugin_aliases.yml file to destination folders"
dependsOn = [copyPluginAlias_ruby, copyPluginAlias_java]
}

tasks.register("copyPluginAlias_ruby", Copy) {
description "Copy the marked plugin_aliases.yml file to destination folders"
description = "Copy the marked plugin_aliases.yml file to destination folders"
dependsOn "markAliasDefinitions"

inputs.file("${buildDir}/plugin_aliases_hashed.yml")
Expand All @@ -222,7 +223,7 @@ tasks.register("copyPluginAlias_ruby", Copy) {
}

tasks.register("copyPluginAlias_java", Copy) {
description "Copy the marked plugin_aliases.yml file to destination folders"
description = "Copy the marked plugin_aliases.yml file to destination folders"
dependsOn "markAliasDefinitions"

inputs.file("${buildDir}/plugin_aliases_hashed.yml")
Expand All @@ -234,12 +235,12 @@ tasks.register("copyPluginAlias_java", Copy) {
}

tasks.register("copyPluginTestAlias") {
description "Copy the marked test plugin_aliases.yml file to destination folders"
description = "Copy the marked test plugin_aliases.yml file to destination folders"
dependsOn = [copyPluginTestAlias_ruby, copyPluginTestAlias_java]
}

tasks.register("copyPluginTestAlias_ruby", Copy) {
description "Copy the marked test plugin_aliases.yml file into Ruby's plugin_manager specs"
description = "Copy the marked test plugin_aliases.yml file into Ruby's plugin_manager specs"
dependsOn "markTestAliasDefinitions"

inputs.file(markTestAliasDefinitions.hashedFile)
Expand All @@ -251,7 +252,7 @@ tasks.register("copyPluginTestAlias_ruby", Copy) {
}

tasks.register("copyPluginTestAlias_java", Copy) {
description "Copy the marked test plugin_aliases.yml file into logstash-core's test resources"
description = "Copy the marked test plugin_aliases.yml file into logstash-core's test resources"
dependsOn "markTestAliasDefinitions"

inputs.file("${buildDir}/plugin_aliases_hashed_test.yml")
Expand Down Expand Up @@ -447,30 +448,39 @@ tasks.register("installIntegrationTestGems") {
}
}

tasks.register("downloadFilebeat") {
dependsOn configureArtifactInfo
description "Download Filebeat Snapshot for current branch version: ${version}"
tasks.register("prepareFilebeatDownload") {
dependsOn configureArtifactInfo

def projectRef = project
doLast {
String beatsVersion = projectRef.ext.get("artifactApiVersion")
String downloadedFilebeatName = "filebeat-${beatsVersion}-${projectRef.ext.get("beatsArchitecture")}"
projectRef.ext.set("unpackedFilebeatName", downloadedFilebeatName)

def res = SnapshotArtifactURLs.packageUrls("beats", beatsVersion, downloadedFilebeatName)
projectRef.ext.set("filebeatSnapshotUrl", System.getenv("FILEBEAT_SNAPSHOT_URL") ?: res.packageUrl)
projectRef.ext.set("filebeatDownloadLocation", "${projectDir}/build/${downloadedFilebeatName}.tar.gz")
}
}

tasks.register("downloadFilebeat", Download) {
dependsOn prepareFilebeatDownload
description = "Download Filebeat Snapshot for current branch version: ${version}"

project.ext.set("versionFound", true)
inputs.file("${projectDir}/versions.yml")

doLast {
download {
String beatsVersion = project.ext.get("artifactApiVersion")
String downloadedFilebeatName = "filebeat-${beatsVersion}-${project.ext.get("beatsArchitecture")}"
project.ext.set("unpackedFilebeatName", downloadedFilebeatName)
def projectRef = project

def res = SnapshotArtifactURLs.packageUrls("beats", beatsVersion, downloadedFilebeatName)
project.ext.set("filebeatSnapshotUrl", System.getenv("FILEBEAT_SNAPSHOT_URL") ?: res.packageUrl)
project.ext.set("filebeatDownloadLocation", "${projectDir}/build/${downloadedFilebeatName}.tar.gz")
// Use lazy configuration to get values after prepareFilebeatDownload runs
src { projectRef.ext.filebeatSnapshotUrl }
dest { new File(projectRef.ext.filebeatDownloadLocation) }

src project.ext.filebeatSnapshotUrl
onlyIfNewer true
onlyIfNewer true
retries 3

dest new File(project.ext.filebeatDownloadLocation)
retries 3
}
System.out.println "Downloaded to ${project.ext.filebeatDownloadLocation}"
doLast {
System.out.println "Downloaded to ${projectRef.ext.filebeatDownloadLocation}"
}
}

Expand All @@ -495,11 +505,12 @@ tasks.register("copyFilebeat") {
tasks.register("checkEsSHA") {
dependsOn configureArtifactInfo

description "Download ES version remote's fingerprint file"
description = "Download ES version remote's fingerprint file"

def projectRef = project
doLast {
String esVersion = project.ext.get("artifactApiVersion")
String downloadedElasticsearchName = "elasticsearch-${esVersion}-${project.ext.get("esArchitecture")}"
String esVersion = projectRef.ext.get("artifactApiVersion")
String downloadedElasticsearchName = "elasticsearch-${esVersion}-${projectRef.ext.get("esArchitecture")}"
String remoteSHA

def res = SnapshotArtifactURLs.packageUrls("elasticsearch", esVersion, downloadedElasticsearchName)
Expand Down Expand Up @@ -529,30 +540,39 @@ tasks.register("checkEsSHA") {
}
}

tasks.register("downloadEs") {
dependsOn = [configureArtifactInfo, checkEsSHA]

description "Download ES Snapshot for current branch version: ${version}"
inputs.file("${projectDir}/versions.yml")
tasks.register("prepareEsDownload") {
dependsOn configureArtifactInfo

def projectRef = project
doLast {
download {
String esVersion = project.ext.get("artifactApiVersion")
String downloadedElasticsearchName = "elasticsearch-${esVersion}-${project.ext.get("esArchitecture")}"
String esVersion = projectRef.ext.get("artifactApiVersion")
String downloadedElasticsearchName = "elasticsearch-${esVersion}-${projectRef.ext.get("esArchitecture")}"

project.ext.set("unpackedElasticsearchName", "elasticsearch-${esVersion}")
projectRef.ext.set("unpackedElasticsearchName", "elasticsearch-${esVersion}")

def res = SnapshotArtifactURLs.packageUrls("elasticsearch", esVersion, downloadedElasticsearchName)
project.ext.set("elasticsearchSnapshotURL", System.getenv("ELASTICSEARCH_SNAPSHOT_URL") ?: res.packageUrl)
project.ext.set("elasticsearchDownloadLocation", "${projectDir}/build/${downloadedElasticsearchName}.tar.gz")
def res = SnapshotArtifactURLs.packageUrls("elasticsearch", esVersion, downloadedElasticsearchName)
projectRef.ext.set("elasticsearchSnapshotURL", System.getenv("ELASTICSEARCH_SNAPSHOT_URL") ?: res.packageUrl)
projectRef.ext.set("elasticsearchDownloadLocation", "${projectDir}/build/${downloadedElasticsearchName}.tar.gz")
}
}

src project.ext.elasticsearchSnapshotURL
onlyIfNewer true
retries 3
dest new File(project.ext.elasticsearchDownloadLocation)
}
tasks.register("downloadEs", Download) {
dependsOn = [prepareEsDownload, checkEsSHA]

description = "Download ES Snapshot for current branch version: ${version}"
inputs.file("${projectDir}/versions.yml")

System.out.println "Downloaded to ${project.ext.elasticsearchDownloadLocation}"
def projectRef = project

src { projectRef.ext.elasticsearchSnapshotURL }
dest { new File(projectRef.ext.elasticsearchDownloadLocation) }

onlyIfNewer true
overwrite false
retries 3

doLast {
System.out.println "Downloaded to ${projectRef.ext.elasticsearchDownloadLocation}"
}
}

Expand Down Expand Up @@ -609,7 +629,7 @@ tasks.register("generateLicenseReport", JavaExec) {
String noticePath = "NOTICE.txt"

classpath = project.files([jarFile])
main = "org.logstash.dependencies.Main"
mainClass = "org.logstash.dependencies.Main"
args licenseReportInputCSV,
project.getBuildDir().toString() + "/licenseReportFolders.txt",
licenseReportOutputCSV, noticePath
Expand Down Expand Up @@ -828,7 +848,7 @@ tasks.register("downloadJdk", Download) {

def jdkDetails = new JDKDetails(gradle.ext.versions.bundled_jdk, osName, jdkArch)

description "Download JDK ${jdkDetails.major}, OS: ${osName}"
description = "Download JDK ${jdkDetails.major}, OS: ${osName}"

// find url of build artifact
String artifactApiUrl = jdkDetails.createDownloadUrl()
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
12 changes: 7 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -112,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -203,15 +205,15 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
6 changes: 4 additions & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -68,11 +70,11 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
8 changes: 6 additions & 2 deletions logstash-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ configurations.archives {

tasks.register("javaTests", Test) {
dependsOn ':bootstrap'
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
exclude '/org/logstash/RSpecTests.class'
exclude '/org/logstash/config/ir/ConfigCompilerTest.class'
exclude '/org/logstash/config/ir/CompiledPipelineTest.class'
Expand Down Expand Up @@ -136,6 +138,8 @@ javaTests.finalizedBy(jacocoTestReport)

tasks.register("rubyTests", Test) {
dependsOn compileTestJava
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
inputs.files fileTree("${projectDir}/lib")
inputs.files fileTree("${projectDir}/spec")
systemProperty 'logstash.root.dir', projectDir.parent
Expand Down Expand Up @@ -171,10 +175,10 @@ tasks {
artifacts {
sources(sourcesJar) {
// Weird Gradle quirk where type will be used for the extension, but only for sources
type 'jar'
type = 'jar'
}
javadoc(javadocJar) {
type 'javadoc'
type = 'javadoc'
}
}

Expand Down
Loading