diff options
author | Sorin Basca <sorinbasca@google.com> | 2024-03-21 16:41:57 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-21 16:41:57 +0000 |
commit | 4ac020dc5ec0b42fc858c9ef7d52e559e98140cb (patch) | |
tree | fc213778b788b80615dbbb7bc3f12a6a6194593d | |
parent | 649ef16dc2c4563b809b8bb8acb54806d380630e (diff) | |
parent | 1d7885f4c04f1cbce774da936a547bba20da1275 (diff) | |
download | platform_testing-4ac020dc5ec0b42fc858c9ef7d52e559e98140cb.tar.gz |
Merge "Allow devs to ignore the 'Wrong java version' error" into main
-rw-r--r-- | scripts/test-utils-script | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/test-utils-script b/scripts/test-utils-script index 80ed0f122..224ac425c 100644 --- a/scripts/test-utils-script +++ b/scripts/test-utils-script @@ -50,16 +50,21 @@ checkJavaVersion() { >&2 echo "Java command: $java_cmd" >&2 echo "PATH value:" >&2 echo "$PATH" - exit 8 + if [ "${IGNORE_JAVA_VERSION_ERROR}" == "y" ]; then + >&2 echo "Ignoring the wrong java version error as \$IGNORE_JAVA_VERSION_ERROR is set to 'y'" + else + >&2 echo "If you want to ignore this error, set \$IGNORE_JAVA_VERSION_ERROR to 'y'" + exit 8 + fi fi } getAddOpensFlag() { - # check if java is above 9 and supports add-opens local java_cmd=$1 local java_version_string=$(${java_cmd} -version 2>&1 | grep -E "\<version\>") - local JAVA_VERSION=$(echo "$java_version_string" | grep -E 'version [ "](9|11|17|21).*[ "]') - if [ "${JAVA_VERSION}" != "" ]; then + # java versions below 1.8 are not supported, java versions above 1.8 need add-opens + local JAVA_VERSION=$(echo "$java_version_string" | grep -E 'version [ "]1\.8.*[ "]') + if [ "${JAVA_VERSION}" == "" ]; then echo "--add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.reflect.annotation=ALL-UNNAMED" fi } |