JAL-3599 fixed placement of 'First Run' file for chromium profile
[jalview.git] / build.gradle
index 6517f43..e0c80e3 100644 (file)
@@ -4219,8 +4219,9 @@ task jalviewjsCopyStderrLaunchFile(type: Copy) {
 }
 
 task jalviewjsChromiumProfile {
-  def profileDir = "${jalviewjsBuildDir}/${jalviewjs_chromium_user_dir}/${jalviewjs_chromium_profile_name}"
-  def firstRun = file("${profileDir}/First Run")
+  def userDir = "${jalviewjsBuildDir}/${jalviewjs_chromium_user_dir}"
+  def profileDir = "${userDir}/${jalviewjs_chromium_profile_name}"
+  def firstRun = file("${userDir}/First Run")
 
   doFirst {
     mkdir profileDir
@@ -4242,16 +4243,34 @@ task jalviewjsLaunchTest(type: Exec) {
     chromiumBinary = System.getProperty("user.home") + chromiumBinary.substring(1)
   }
   
+  def stdout
+  def stderr
   doFirst {
     def exec = file(chromiumBinary)
     if (!exec.exists()) {
       throw new GradleException("Could not find chromium binary '${chromiumBinary}'. Cannot run task ${name}.")
     }
+    
+    stdout = new ByteArrayOutputStream()
+    stderr = new ByteArrayOutputStream()
+    if (jalviewjs_j2s_to_console.equals("true")) {
+      standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
+        stdout,
+        System.out)
+      errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
+        stderr,
+        System.err)
+    } else {
+      standardOutput = stdout
+      errorOutput = stderr
+    }
   }
 
   executable(chromiumBinary)
   args([
+    "--no-sandbox", // --no-sandbox IS USED BY THE THORIUM APPIMAGE ON THE BUILDSERVER
     "--headless=new",
+    "--disable-gpu",
     "--timeout=60000",
     "--virtual-time-budget=60000",
     "--user-data-dir=${jalviewjsBuildDir}/${jalviewjs_chromium_user_dir}",
@@ -4260,19 +4279,10 @@ task jalviewjsLaunchTest(type: Exec) {
     "--enable-logging=stderr",
     jalviewjsStderrLaunchFilename
   ])
-
-  standardOutput = new ByteArrayOutputStream()
-  errorOutput = new ByteArrayOutputStream()
   
   doLast {
-    println("Chrome STDOUT: ")
-    println(standardOutput.toString())
-    println("Chrome STDERR: ")
-    println(errorOutput.toString())
-
     def found = false
-    def stderr = errorOutput.toString()
-    stderr.eachLine { line ->
+    stderr.toString().eachLine { line ->
       if (line.contains(jalviewjs_desktop_init_string)) {
         println("Found line '"+line+"'")
         found = true
@@ -4280,8 +4290,7 @@ task jalviewjsLaunchTest(type: Exec) {
       }
     }
     if (!found) {
-      
       throw new GradleException("Could not find evidence of Desktop launch in JalviewJS.")
     }
-  }
+  } 
 }