JAL-3130 ensure J11 libs/modules are added when building and running test suite
authorJim Procter <jprocter@issues.jalview.org>
Thu, 11 Apr 2019 13:37:58 +0000 (14:37 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 11 Apr 2019 13:37:58 +0000 (14:37 +0100)
build.gradle

index 4a63af9..d4140bd 100644 (file)
@@ -95,6 +95,26 @@ compileJava {
 
 }
 
+compileTestJava {
+
+  doFirst {
+    if (JAVA_VERSION.equals("1.8")) {
+      sourceCompatibility = 1.8
+      targetCompatibility = 1.8
+    } else if (JAVA_VERSION.equals("11")) {
+      sourceCompatibility = 11
+      targetCompatibility = 11
+
+      options.compilerArgs = [
+        '--module-path', sourceSets.modules.compileClasspath.asPath,
+        '--add-modules', j11modules
+      ]
+    }
+    print ("Setting target compatibility to "+targetCompatibility+"\n")
+  }
+
+}
+
 clean {
   delete sourceSets.main.java.outputDir
 }
@@ -197,11 +217,29 @@ task prepare {
 test {
   dependsOn prepare
   dependsOn compileJava
+  dependsOn compileTestJava
   useTestNG {
     includeGroups testngGroups
+    preserveOrder true
   }
+  
   workingDir = jalviewDir
   //systemProperties 'clover.jar' System.properties.clover.jar
+  if (JAVA_VERSION.equals("1.8")) {
+    sourceCompatibility = 1.8
+    targetCompatibility = 1.8
+  } else if (JAVA_VERSION.equals("11")) {
+    sourceCompatibility = 11
+    targetCompatibility = 11
+
+    jvmArgs += [
+      '--module-path',
+      sourceSets.modules.compileClasspath.asPath,
+      '--add-modules',
+      j11modules
+    ]
+  }
+  print ("Setting target compatibility to "+targetCompatibility+"\n")
 }
 
 task buildIndices(type: JavaExec) {