Merge branch 'jims/JAL-3130_Java11_Gradle_publishing' into bug/JAL-3224_getdown_chang...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 22 Apr 2019 11:46:48 +0000 (12:46 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 22 Apr 2019 11:46:48 +0000 (12:46 +0100)
build.gradle
gradle.properties
test/jalview/bin/CommandLineOperations.java

index 45a757e..b4a5077 100644 (file)
@@ -28,10 +28,10 @@ mainClassName = launcherClass
 def cloverInstrDir = file("$buildDir/$cloverSourcesInstrDir")
 def classes = "$jalviewDir/$classesDir"
 if (clover.equals("true")) {
-  clover = true
+  use_clover = true
   classes = "$buildDir/$cloverClassesDir"
 } else {
-  clover = false
+  use_clover = false
   classes = "$jalviewDir/$classesDir"
 }
 
@@ -115,10 +115,11 @@ sourceSets {
     }
 
     compileClasspath = files( sourceSets.test.java.outputDir ) 
-    if (clover) {
+    if (use_clover) {
       compileClasspath += sourceSets.clover.compileClasspath
     } else {
       compileClasspath += sourceSets.main.compileClasspath
+      compileClasspath += files(sourceSets.main.java.outputDir)
     }
     compileClasspath += files( sourceSets.main.resources.srcDirs)
     compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
@@ -130,7 +131,7 @@ sourceSets {
 
 // clover bits
 dependencies {
-  if (clover) {
+  if (use_clover) {
     cloverCompile 'org.openclover:clover:4.3.1'
     testCompile 'org.openclover:clover:4.3.1'
   }
@@ -194,9 +195,12 @@ compileJava {
 }
 
 compileTestJava {
-  if (clover) {
+
+  if (use_clover) {
     dependsOn compileCloverJava
     classpath += configurations.cloverRuntime
+  } else {
+    classpath += sourceSets.main.runtimeClasspath
   }
   doFirst {
     sourceCompatibility = compile_source_compatibility
@@ -321,10 +325,11 @@ task prepare {
 //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
 test {
   dependsOn prepare
-  if (clover) {
+  dependsOn compileJava
+  if (use_clover) {
     dependsOn cloverInstr
   }
-  print("Running tests " + (clover?"WITH":"WITHOUT") + " clover [clover="+clover+"]\n") 
+  print("Running tests " + (use_clover?"WITH":"WITHOUT") + " clover [clover="+use_clover+"]\n") 
   
   useTestNG() {
     includeGroups testngGroups
index 7eda59b..690f529 100644 (file)
@@ -28,6 +28,7 @@ sourceDir = src
 schemaDir = schemas
 classesDir = classes
 clover = false
+use_clover = false
 cloverClassesDir = clover-classes
 cloverSourcesInstrDir = sources-instr
 packageDir = dist
index cb08563..9d8a993 100644 (file)
@@ -129,6 +129,8 @@ public class CommandLineOperations
 
   private static String modules = null;
 
+  private static String java_exe = null;
+
   public synchronized static String getClassPath()
   {
     if (scanner == null)
@@ -141,6 +143,9 @@ public class CommandLineOperations
       {
         modules.concat(mr.getName());
       }
+      java_exe = System.getProperty("java.home") + File.separator + "bin"
+              + File.separator + "java";
+
     }
     while (classpath == null)
     {
@@ -161,7 +166,8 @@ public class CommandLineOperations
     // Note: JAL-3065 - don't include quotes for lib/* because the arguments are
     // not expanded by the shell
     String classpath = getClassPath();
-    String _cmd = "java " + (withAwt ? "-Djava.awt.headless=true" : "")
+    String _cmd = java_exe + " "
+            + (withAwt ? "-Djava.awt.headless=true" : "")
             + " -classpath " + classpath
             + (modules.length() > 2 ? "--add-modules=\"" + modules + "\""
                     : "")
@@ -204,7 +210,6 @@ public class CommandLineOperations
       Path currentRelativePath = Paths.get("");
       String s = currentRelativePath.toAbsolutePath().toString();
       System.out.println("Test CWD is " + s);
-      System.err.println("Test CWD is " + s);
     } catch (Exception q)
     {
       q.printStackTrace();