JAL-3599 Cater for macOS. --timeout not working yet
authorBen Soares <b.soares@dundee.ac.uk>
Sun, 11 Jun 2023 14:38:17 +0000 (15:38 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Sun, 11 Jun 2023 14:38:17 +0000 (15:38 +0100)
build.gradle
gradle.properties

index f2aced5..3284b5b 100644 (file)
@@ -4217,6 +4217,9 @@ task jalviewjsChromiumProfile {
   def firstRun = file("${userDir}/First Run")
 
   doFirst {
+    // clear out old profile
+    delete profileDir
+
     mkdir profileDir
     firstRun.text = ""
   }
@@ -4227,11 +4230,12 @@ task jalviewjsChromiumProfile {
 task jalviewjsLaunchTest(type: Exec) {
   group "Test"
   description "Check JalviewJS opens in a browser"
-  dependsOn jalviewjsBuildSite
+//  dependsOn jalviewjsBuildSite
   dependsOn jalviewjsCopyStderrLaunchFile
   dependsOn jalviewjsChromiumProfile
 
-  def chromiumBinary = jalviewjs_chromium_binary
+  def macOS = OperatingSystem.current().isMacOsX()
+  def chromiumBinary = macOS ? jalviewjs_macos_chromium_binary : jalviewjs_chromium_binary
   if (chromiumBinary.startsWith("~/")) {
     chromiumBinary = System.getProperty("user.home") + chromiumBinary.substring(1)
   }
@@ -4239,8 +4243,8 @@ task jalviewjsLaunchTest(type: Exec) {
   def stdout
   def stderr
   doFirst {
-    def exec = file(chromiumBinary)
-    if (!exec.exists()) {
+    def binary = file(chromiumBinary)
+    if (!binary.exists()) {
       throw new StopExecutionException("Could not find chromium binary '${chromiumBinary}'. Cannot run task ${name}.")
     }
     
@@ -4259,18 +4263,20 @@ task jalviewjsLaunchTest(type: Exec) {
     }
   }
 
+  def timeoutms = Integer.valueOf(jalviewjs_chromium_timeout) * 1000
+
   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}",
+    "--timeout=${timeoutms}",
+    "--virtual-time-budget=${timeoutms}",
+    "--user-data-dir=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_chromium_user_dir}",
     "--profile-directory=${jalviewjs_chromium_profile_name}",
     "--allow-file-access-from-files",
     "--enable-logging=stderr",
-    jalviewjsStderrLaunchFilename
+    "file://${jalviewDirAbsolutePath}/${jalviewjsStderrLaunchFilename}"
   ])
   
   doLast {
index 93bf118..75231f3 100644 (file)
@@ -262,7 +262,9 @@ jalviewjs_j2s_closure_stdout = j2s-closure.out
 
 # for checking jalviewjs launches okay
 jalviewjs_chromium_binary = ~/buildtools/chromium/chrome
+jalviewjs_macos_chromium_binary = /Applications/Chromium.app/Contents/MacOS/Chromium
 jalviewjs_chromium_user_dir = chromium
+jalviewjs_chromium_timeout = 30
 jalviewjs_chromium_profile_name = BUILD
 jalviewjs_stderr_launch = utils/jalviewjs/chromium_test/jalview_bin_Jalview-stderr.html
 jalviewjs_desktop_init_string = JALVIEWJS: CREATED DESKTOP