JAL-4492 JAL-3907 Added applet exclusions to gradle build. Updated shadowJar to allow...
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 27 Nov 2024 15:48:07 +0000 (15:48 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 27 Nov 2024 15:48:07 +0000 (15:48 +0000)
build.gradle
gradle.properties

index a350de3..974df98 100644 (file)
@@ -52,7 +52,7 @@ plugins {
   id 'application'
   id 'eclipse'
   id "com.diffplug.gradle.spotless" version "3.28.0"
-  id 'com.github.johnrengelman.shadow' version '6.0.0'
+  id 'com.github.johnrengelman.shadow' version '7.1.2'
   id 'com.install4j.gradle' version '10.0.8'
   id 'com.dorongold.task-tree' version '2.1.1' // only needed to display task dependency tree with  gradle task1 [task2 ...] taskTree
   id 'com.palantir.git-version' version '0.13.0' apply false
@@ -508,12 +508,12 @@ ext {
      */
   } else if (JAVA_VERSION.equals("17")) {
     JAVA_INTEGER_VERSION = string("17")
-    libDir = j17libDir
-    libDistDir = j17libDir
+    libDir = j11libDir
+    libDistDir = j11libDir
     compile_source_compatibility = 17
     compile_target_compatibility = 17
-    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
-    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
+    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")
     /* compile without modules -- using classpath libraries
@@ -599,6 +599,18 @@ ext {
   if (!project.hasProperty("jalviewLite")) {
     jalviewLite = false
   }
+  codeExclusions = [
+    "jalview/bin/JalviewLite.java",
+    "jalview/bin/JalviewLiteURLRetrieve.java",
+    "jalview/urls/applet/**",
+    "jalview/javascript/*.java",
+    "jalview/appletgui/**",
+    "mc_view/Applet*.java"
+  ]
+  testExclusions = [
+    "jalview/bin/JalviewLiteTest.java",
+    "jalview/urls/AppletUrlProviderFactoryTest.java"
+  ]
   // ENDEXT
 }
 
@@ -609,17 +621,13 @@ gradle.taskGraph.whenReady { graph ->
 
 
 sourceSets {
+
   main {
     java {
       srcDirs sourceDir
 
-      if (! jalviewLite) {
-        exclude "${sourceDir}/jalview/bin/JalviewLite.java"
-        exclude "${sourceDir}/jalview/urls/applet/**"
-        exclude "${sourceDir}/jalview/javascript/*.java"
-        exclude "${sourceDir}/jalview/appletgui/**"
-        exclude "${sourceDir}/com/stevesoft/**"
-        exclude "${sourceDir}/mc_view/Applet*.java"
+      if (!jalviewLite) {
+        codeExclusions.each { it0 -> exclude it0 }
       }
 
       outputDir = file(classesDir)
@@ -636,10 +644,16 @@ sourceSets {
     runtimeClasspath += files(sourceSets.main.resources.srcDirs)
   }
 
+  if (useClover) {
   clover {
     java {
       srcDirs cloverInstrDir
       outputDir = cloverClassesDir
+
+      if (!jalviewLite) {
+        codeExclusions.each { it1 -> exclude it1 }
+        testExclusions.each { it2 -> exclude it2 }
+      }
     }
 
     resources {
@@ -654,13 +668,15 @@ sourceSets {
 
     runtimeClasspath = compileClasspath
   }
+  }
 
   test {
     java {
       srcDirs testSourceDir
 
-      if (! jalviewLite) {
-        exclude "${testSourceDir}/jalview/bin/JalviewLiteTest.java"
+      if (!jalviewLite) {
+        exclude "jalview/bin/JalviewLiteTest.java"
+        exclude "jalview/urls/AppletUrlProviderFactoryTest.java"
       }
 
       outputDir = file(testClassesDir)
@@ -908,7 +924,7 @@ task cloverInstrJava(type: JavaExec) {
   outputs.dir(cloverInstrDir)
 
   //classpath = fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
-  classpath = sourceSets.clover.compileClasspath
+  classpath = useClover ? sourceSets.clover.compileClasspath : sourceSets.main.compileClasspath
   main = "com.atlassian.clover.CloverInstr"
 
   def argsList = [
@@ -943,7 +959,7 @@ task cloverInstrTests(type: JavaExec) {
   inputs.files(testDir)
   outputs.dir(cloverTestInstrDir)
 
-  classpath = sourceSets.clover.compileClasspath
+  classpath = useClover ? sourceSets.clover.compileClasspath : sourceSets.main.compileClasspath
   main = "com.atlassian.clover.CloverInstr"
 
   def argsList = [
@@ -973,9 +989,9 @@ task cloverInstr {
   dependsOn cloverInstrTests
 }
 
-
-cloverClasses.dependsOn cloverInstr
-
+if (useClover) {
+  cloverClasses.dependsOn cloverInstr
+}
 
 task cloverConsoleReport(type: JavaExec) {
   group = "Verification"
@@ -987,7 +1003,7 @@ task cloverConsoleReport(type: JavaExec) {
 
   inputs.dir cloverClassesDir
 
-  classpath = sourceSets.clover.runtimeClasspath
+  classpath = useClover ? sourceSets.clover.runtimeClasspath : sourceSets.main.runtimeClasspath
   main = "com.atlassian.clover.reporters.console.ConsoleReporter"
 
   if (cloverreport_mem.length() > 0) {
@@ -1020,7 +1036,7 @@ task cloverHtmlReport(type: JavaExec) {
   inputs.dir cloverClassesDir
   outputs.dir cloverHtmlDir
 
-  classpath = sourceSets.clover.runtimeClasspath
+  classpath = useClover ? sourceSets.clover.runtimeClasspath : sourceSets.main.runtimeClasspath
   main = "com.atlassian.clover.reporters.html.HtmlReporter"
 
   if (cloverreport_mem.length() > 0) {
@@ -1058,7 +1074,7 @@ task cloverXmlReport(type: JavaExec) {
   inputs.dir cloverClassesDir
   outputs.file cloverXmlFile
 
-  classpath = sourceSets.clover.runtimeClasspath
+  classpath = useClover ? sourceSets.clover.runtimeClasspath : sourceSets.main.runtimeClasspath
   main = "com.atlassian.clover.reporters.xml.XMLReporter"
 
   if (cloverreport_mem.length() > 0) {
@@ -1092,16 +1108,17 @@ task cloverReport {
   dependsOn cloverHtmlReport
 }
 
+if (useClover) {
+  compileCloverJava {
 
-compileCloverJava {
-
-  doFirst {
-    sourceCompatibility = compile_source_compatibility
-    targetCompatibility = compile_target_compatibility
-    options.compilerArgs += additional_compiler_args
-    print ("Setting target compatibility to "+targetCompatibility+"\n")
+    doFirst {
+      sourceCompatibility = compile_source_compatibility
+      targetCompatibility = compile_target_compatibility
+      options.compilerArgs += additional_compiler_args
+      print ("Setting target compatibility to "+targetCompatibility+"\n")
+    }
+    //classpath += configurations.cloverRuntime
   }
-  //classpath += configurations.cloverRuntime
 }
 // end clover bits
 
@@ -2243,6 +2260,7 @@ shadowJar {
     // shadowJar manifest must inheritFrom another Jar task.  Can't set attributes here.
     inheritFrom(project.tasks.launcherJar.manifest)
   }
+
   // we need to include the groovy-swing Include-Package for it to run in the shadowJar
   doFirst {
     def jarFileManifests = []
@@ -2263,6 +2281,7 @@ shadowJar {
     }
   }
 
+
   duplicatesStrategy "INCLUDE"
 
   // this mainClassName is mandatory but gets ignored due to manifest created in doFirst{}. Set the Main-Class as an attribute in launcherJar instead
index 823264c..7e23d30 100644 (file)
@@ -115,7 +115,9 @@ 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 =
+getdown_alt_java11_max_version = 11009999
+getdown_alt_java17_min_version = 17000000
+getdown_alt_java17_max_version = 17009999
 #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