You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by dc...@apache.org on 2021/08/26 11:29:19 UTC

[datasketches-memory] branch single-build-script updated: Add attribution for version parsing

This is an automated email from the ASF dual-hosted git repository.

dcromberge pushed a commit to branch single-build-script
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git


The following commit(s) were added to refs/heads/single-build-script by this push:
     new 959e104  Add attribution for version parsing
959e104 is described below

commit 959e10433d5391b527d67e3e200076d5f750fb49
Author: David Cromberge <dc...@apache.org>
AuthorDate: Thu Aug 26 12:29:08 2021 +0100

    Add attribution for version parsing
---
 tools/scripts/compile-package-jar.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/scripts/compile-package-jar.sh b/tools/scripts/compile-package-jar.sh
index fff53cd..5c1548f 100755
--- a/tools/scripts/compile-package-jar.sh
+++ b/tools/scripts/compile-package-jar.sh
@@ -70,6 +70,10 @@ fi
 
 #### Parse java -version into major version number ####
 if [[ "$Java_" ]]; then
+  # This expression extracts the correct major version of the Java runtime.
+  # For older runtime versions, such as 1.8, the leading '1.' is removed.
+  # Adapted from this answer on StackOverflow:
+  # https://stackoverflow.com/questions/7334754/correct-way-to-check-java-version-from-bash-script/56243046#56243046
   JavaVersion=$("$Java_" -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
 else
   echo "No version information could be determined from installed JDK."; exit 1;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org