You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/04/03 11:15:09 UTC
[plc4x] branch develop updated: - Added a check to the
prerequisiteCheck.groovy that checks if your java version isn't above 11 if
the logstash profile is enabled - Made the exec-maven-plugin forward the
setting for the current JVM to the gradle process (Otherwise it would have
just used the java executable on the PATH)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 6ed176b - Added a check to the prerequisiteCheck.groovy that checks if your java version isn't above 11 if the logstash profile is enabled - Made the exec-maven-plugin forward the setting for the current JVM to the gradle process (Otherwise it would have just used the java executable on the PATH)
6ed176b is described below
commit 6ed176b7952795f590156b011ffe189259eb83ac
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Apr 3 13:15:01 2020 +0200
- Added a check to the prerequisiteCheck.groovy that checks if your java version isn't above 11 if the logstash profile is enabled
- Made the exec-maven-plugin forward the setting for the current JVM to the gradle process (Otherwise it would have just used the java executable on the PATH)
---
src/main/script/prerequisiteCheck.groovy | 60 ++++++++++++++++++++++++++++++--
tools/logstash/pom.xml | 7 ++++
2 files changed, 64 insertions(+), 3 deletions(-)
diff --git a/src/main/script/prerequisiteCheck.groovy b/src/main/script/prerequisiteCheck.groovy
index 8f2f69b..d65df48 100644
--- a/src/main/script/prerequisiteCheck.groovy
+++ b/src/main/script/prerequisiteCheck.groovy
@@ -34,7 +34,7 @@ def checkVersionAtLeast(String current, String minimum) {
def currentSegment = currentSegments[i].toInteger()
def minimumSegment = minimumSegments[i].toInteger()
if(currentSegment < minimumSegment) {
- println current.padRight(14) + "FAILED (required " + minimum + ")"
+ println current.padRight(14) + "FAILED (required min " + minimum + " but got " + current + ")"
return false
} else if(currentSegment > minimumSegment) {
println current.padRight(14) + "OK"
@@ -45,7 +45,31 @@ def checkVersionAtLeast(String current, String minimum) {
if(curNotShorter) {
println current.padRight(14) + " OK"
} else {
- println current.padRight(14) + " (required " + minimum + ")"
+ println current.padRight(14) + " (required min " + minimum + " but got " + current + ")"
+ }
+ curNotShorter
+}
+
+def checkVersionAtMost(String current, String maximum) {
+ def currentSegments = current.tokenize('.')
+ def maximumSegments = maximum.tokenize('.')
+ def numSegments = Math.min(currentSegments.size(), maximumSegments.size())
+ for (int i = 0; i < numSegments; ++i) {
+ def currentSegment = currentSegments[i].toInteger()
+ def maximumSegment = maximumSegments[i].toInteger()
+ if(currentSegment > maximumSegment) {
+ println current.padRight(14) + "FAILED (required max " + maximum + " but got " + current + ")"
+ return false
+ } else if(currentSegment < maximumSegment) {
+ println current.padRight(14) + "OK"
+ return true
+ }
+ }
+ def curNotShorter = currentSegments.size() >= maximumSegments.size()
+ if(curNotShorter) {
+ println current.padRight(14) + " OK"
+ } else {
+ println current.padRight(14) + " (required max " + maximum + " but got " + current + ")"
}
curNotShorter
}
@@ -92,6 +116,27 @@ def checkDotnet() {
}
}
+
+def checkJavaVersion(String minVersion, String maxVersion) {
+ print "Detecting Java version: "
+ def curVersion = System.properties['java.version']
+ def result
+ if(minVersion != null) {
+ result = checkVersionAtLeast(curVersion, minVersion)
+ if(!result) {
+ allConditionsMet = false
+ return
+ }
+ }
+ if(maxVersion != null) {
+ result = checkVersionAtMost(curVersion, maxVersion)
+ if(!result) {
+ allConditionsMet = false
+ return
+ }
+ }
+}
+
def checkFlex() {
print "Detecting Flex version: "
def output
@@ -359,9 +404,10 @@ println "Detected Arch: " + arch
println "Enabled profiles:"
def boostEnabled = false
def cppEnabled = false
-def dockerEnabled = false;
+def dockerEnabled = false
def dotnetEnabled = false
def javaEnabled = true
+def logstashEnabled = false
def pythonEnabled = false
def proxiesEnabled = false
def sandboxEnabled = false
@@ -379,6 +425,9 @@ for (def activeProfile : activeProfiles) {
} else if(activeProfile == "with-dotnet") {
dotnetEnabled = true
println "dotnet"
+ } else if(activeProfile == "with-logstash") {
+ logstashEnabled = true
+ println "logstash"
} else if(activeProfile == "with-python") {
pythonEnabled = true
println "python"
@@ -425,6 +474,11 @@ if(dotnetEnabled) {
checkDotnet()
}
+if(logstashEnabled) {
+ // Logstash doesn't compile with java versions above 11 (currently)
+ checkJavaVersion(null, "11")
+}
+
if(proxiesEnabled) {
checkFlex()
checkOpenSSL()
diff --git a/tools/logstash/pom.xml b/tools/logstash/pom.xml
index 08042ad..a10bdf8 100644
--- a/tools/logstash/pom.xml
+++ b/tools/logstash/pom.xml
@@ -66,6 +66,13 @@
</goals>
<configuration>
<executable>${gradlew.executable}</executable>
+ <!--
+ Make sure Gradle is using the same Java version the current build is using.
+ Without this setting it would use the java executable located in the Path.
+ -->
+ <environmentVariables>
+ <JAVA_HOME>${java.home}</JAVA_HOME>
+ </environmentVariables>
<arguments>
<argument>:logstash-core:jar</argument>
</arguments>