JAL-3907 Add Java21 compliance to the build and download_jdk/jre helpers bug/JAL-4492_gradle_build_not_excluding_classes
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 28 Nov 2024 18:04:29 +0000 (18:04 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 28 Nov 2024 18:04:29 +0000 (18:04 +0000)
build.gradle
gradle.properties
utils/download_jdks.sh
utils/download_jres.sh

index 974df98..28e03bd 100644 (file)
@@ -476,46 +476,24 @@ ext {
 
   additional_compiler_args = []
   // configure classpath/args for j8/j11 compilation
-  if (JAVA_VERSION.equals("1.8")) {
-    JAVA_INTEGER_VERSION = string("8")
-    //libDir = j8libDir
+  
+  
+  if (JAVA_VERSION in [ "1.8", "8", "11", "17", "21" ]) {
+    if (JAVA_VERSION.equals("8")) {
+      JAVA_VERSION = "1.8"
+    }
+    JAVA_INTEGER_VERSION = JAVA_VERSION.equals("1.8") ? 8 : JAVA_VERSION as Integer
     libDir = j11libDir
-    libDistDir = j8libDir
-    compile_source_compatibility = 1.8
-    compile_target_compatibility = 1.8
+    libDistDir = JAVA_INTEGER_VERSION == 8  ? j8libDir : j11libDir
+    compile_source_compatibility = JAVA_VERSION
+    compile_target_compatibility = JAVA_VERSION
     // these are getdown.txt properties defined dependent on the JAVA_VERSION
-    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java8_min_version"))
-    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java8_max_version"))
+    getdownAltJavaMinVersion = JAVA_INTEGER_VERSION == 8 ? "01080000" : string(JAVA_INTEGER_VERSION * 1000000)
+    getdownAltJavaMaxVersion = JAVA_INTEGER_VERSION == 8 ? "01089999" : string(JAVA_INTEGER_VERSION * 1000000 + 999999)
     // this property is assigned below and expanded to multiple lines in the getdown task
-    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java8_txt_multi_java_location"))
+    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java${JAVA_INTEGER_VERSION}_txt_multi_java_location"))
     // this property is for the Java library used in eclipse
-    eclipseJavaRuntimeName = string("JavaSE-1.8")
-  } else if (JAVA_VERSION.equals("11")) {
-    JAVA_INTEGER_VERSION = string("11")
-    libDir = j11libDir
-    libDistDir = j11libDir
-    compile_source_compatibility = 11
-    compile_target_compatibility = 11
-    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
-    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
-    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
-    eclipseJavaRuntimeName = string("JavaSE-11")
-    /* compile without modules -- using classpath libraries
-    additional_compiler_args += [
-    '--module-path', modules_compileClasspath.asPath,
-    '--add-modules', j11modules
-    ]
-     */
-  } else if (JAVA_VERSION.equals("17")) {
-    JAVA_INTEGER_VERSION = string("17")
-    libDir = j11libDir
-    libDistDir = j11libDir
-    compile_source_compatibility = 17
-    compile_target_compatibility = 17
-    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java17_min_version"))
-    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java17_max_version"))
-    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
-    eclipseJavaRuntimeName = string("JavaSE-17")
+    eclipseJavaRuntimeName = string("JavaSE-${JAVA_VERSION}")
     /* compile without modules -- using classpath libraries
     additional_compiler_args += [
     '--module-path', modules_compileClasspath.asPath,
@@ -523,7 +501,7 @@ ext {
     ]
      */
   } else {
-    throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview")
+    throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview build")
   }
 
 
index b80cc0a..546ccc6 100644 (file)
@@ -112,12 +112,6 @@ getdown_txt_ui.progress_text = 000000
 getdown_txt_ui.status = 20, 380, 600, 58
 getdown_txt_ui.status_text = 000066
 getdown_txt_ui.install_error = https://www.jalview.org/faq/getdownerror
-getdown_alt_java8_min_version  = 01080000
-getdown_alt_java8_max_version  = 01089999
-getdown_alt_java11_min_version = 11000000
-getdown_alt_java11_max_version = 11999999
-getdown_alt_java17_min_version = 17000000
-getdown_alt_java17_max_version = 17999999
 #getdown_alt_java11_txt_multi_java_location = [windows-amd64] /getdown/jre/jre-11-windows-x64.zip,[linux-amd64] /getdown/jre/jre-11-linux-x64.zip,[mac os x] /getdown/jre/jre-11-mac-x64.zip
 #getdown_alt_java8_txt_multi_java_location = [windows-amd64] /getdown/jre/jre-8-windows-x64.zip,[linux-amd64] /getdown/jre/jre-8-linux-x64.zip,[mac os x] /getdown/jre/jre-8-mac-x64.zip
 jre_installs_dir = ~/buildtools/jre
index b6e8379..020e601 100755 (executable)
@@ -74,8 +74,10 @@ dl_zulu() {
 
 declare -A DOWNLOAD_SUMMARY
 
-for FEATURE_VERSION in 8 11 17; do
-  for OS_ARCH in mac:x64 mac:aarch64 windows:x64 linux:x64 linux:arm linux:aarch64; do
+for FEATURE_VERSION in 8 11 17 21; do
+  # Choose the correct OS_ARCH for your machine. Others not needed.
+  #for OS_ARCH in mac:x64 mac:aarch64 windows:x64 linux:x64 linux:aarch64; do
+  for OS_ARCH in linux:x64; do
     OS=${OS_ARCH%:*}
     ARCH=${OS_ARCH#*:}
     NAME="${IMAGE_TYPE}-${FEATURE_VERSION}-${OS}-${ARCH}"
index 5b8b30d..f34c458 100755 (executable)
@@ -73,7 +73,7 @@ dl_zulu() {
 
 declare -A DOWNLOAD_SUMMARY
 
-for FEATURE_VERSION in 8 11 17; do
+for FEATURE_VERSION in 8 11 17 21; do
   for OS_ARCH in mac:x64 mac:aarch64 windows:x64 linux:x64 linux:arm linux:aarch64; do
     OS=${OS_ARCH%:*}
     ARCH=${OS_ARCH#*:}