JAL-3130 specify module list when launching new Jalview for CLI tests
authorJim Procter <jprocter@issues.jalview.org>
Fri, 12 Apr 2019 16:36:22 +0000 (17:36 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 12 Apr 2019 16:36:22 +0000 (17:36 +0100)
test/jalview/bin/CommandLineOperations.java

index ace1868..1761261 100644 (file)
@@ -39,6 +39,7 @@ import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ModuleRef;
 import io.github.classgraph.ScanResult;
 
 public class CommandLineOperations
@@ -124,6 +125,8 @@ public class CommandLineOperations
 
   private static String classpath = null;
 
+  private static String modules = null;
+
   public synchronized static String getClassPath()
   {
     if (scanner == null)
@@ -131,6 +134,11 @@ public class CommandLineOperations
       scanner = new ClassGraph();
       ScanResult scan = scanner.scan();
       classpath = scan.getClasspath();
+      modules = "";
+      for (ModuleRef mr : scan.getModules())
+      {
+        modules.concat(mr.getName());
+      }
     }
     while (classpath == null)
     {
@@ -152,7 +160,10 @@ public class CommandLineOperations
     // not expanded by the shell
     String classpath = getClassPath();
     String _cmd = "java " + (withAwt ? "-Djava.awt.headless=true" : "")
-            + " -classpath " + classpath + " jalview.bin.Jalview ";
+            + " -classpath " + classpath
+            + (modules.length() > 2 ? "--add-modules=\"" + modules + "\""
+                    : "")
+            + " jalview.bin.Jalview ";
     Process ls2_proc = null;
     Worker worker = null;
     try