summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSorin Basca <sorinbasca@google.com>2024-03-21 09:18:36 +0000
committerSorin Basca <sorinbasca@google.com>2024-03-21 10:15:03 +0000
commit1d7885f4c04f1cbce774da936a547bba20da1275 (patch)
tree6eb5ce3a7471d309a8bb91952bb889f044705729
parent6c4ab68b142df06e0648bea61611b827958c31bb (diff)
downloadplatform_testing-1d7885f4c04f1cbce774da936a547bba20da1275.tar.gz
Allow devs to ignore the 'Wrong java version' error
Test: TH Change-Id: I5e258770fdf4364543da184548b7e65492cbabb2
-rw-r--r--scripts/test-utils-script13
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
}