tuned: more robust Scala syntax;
authorwenzelm
Sat, 22 Oct 2022 21:20:55 +0200
changeset 76365 24e951a8a318
parent 76364 2c0f252fb11c
child 76366 640ab184efb4
tuned: more robust Scala syntax;
src/Pure/Admin/build_history.scala
src/Pure/Admin/isabelle_cronjob.scala
--- a/src/Pure/Admin/build_history.scala	Sat Oct 22 20:15:36 2022 +0200
+++ b/src/Pure/Admin/build_history.scala	Sat Oct 22 21:20:55 2022 +0200
@@ -123,18 +123,22 @@
   ): List[(Process_Result, Path)] = {
     /* sanity checks */
 
-    if (File.eq(Path.ISABELLE_HOME, root))
+    if (File.eq(Path.ISABELLE_HOME, root)) {
       error("Repository coincides with ISABELLE_HOME=" + Path.ISABELLE_HOME.expand)
+    }
 
-    for ((threads, _) <- multicore_list if threads < 1)
+    for ((threads, _) <- multicore_list if threads < 1) {
       error("Bad threads value < 1: " + threads)
-    for ((_, processes) <- multicore_list if processes < 1)
+    }
+    for ((_, processes) <- multicore_list if processes < 1) {
       error("Bad processes value < 1: " + processes)
+    }
 
     if (heap < 100) error("Bad heap value < 100: " + heap)
 
-    if (max_heap.isDefined && max_heap.get < heap)
+    if (max_heap.isDefined && max_heap.get < heap) {
       error("Bad max_heap value < heap: " + max_heap.get)
+    }
 
     System.getenv("ISABELLE_SETTINGS_PRESENT") match {
       case null | "" =>
@@ -204,8 +208,9 @@
       if (first_build) {
         other_isabelle.resolve_components(echo = verbose)
 
-        if (fresh)
+        if (fresh) {
           Isabelle_System.rm_tree(other_isabelle.isabelle_home + Path.explode("lib/classes"))
+        }
         other_isabelle.bash(
           "env PATH=\"" + File.bash_path(Path.explode("~~/lib/dummy_stty").expand) + ":$PATH\" " +
             "bin/isabelle jedit -b", redirect = true, echo = verbose).check
@@ -237,8 +242,9 @@
 
       /* build */
 
-      if (multicore_base && !first_build && isabelle_base_log.is_dir)
+      if (multicore_base && !first_build && isabelle_base_log.is_dir) {
         Isabelle_System.copy_dir(isabelle_base_log, isabelle_output_log)
+      }
 
       val build_start = Date.now()
       val build_args1 = List("-v", "-j" + processes) ::: afp_build_args ::: build_args
@@ -347,8 +353,9 @@
       val heap_sizes =
         build_info.finished_sessions.flatMap { session_name =>
           val heap = isabelle_output + Path.explode(session_name)
-          if (heap.is_file)
+          if (heap.is_file) {
             Some("Heap " + session_name + " (" + Value.Long(heap.file.length) + " bytes)")
+          }
           else None
         }
 
@@ -364,8 +371,9 @@
 
       /* next build */
 
-      if (multicore_base && first_build && isabelle_output_log.is_dir)
+      if (multicore_base && first_build && isabelle_output_log.is_dir) {
         Isabelle_System.copy_dir(isabelle_output_log, isabelle_base_log)
+      }
 
       Isabelle_System.rm_tree(isabelle_output)
 
--- a/src/Pure/Admin/isabelle_cronjob.scala	Sat Oct 22 20:15:36 2022 +0200
+++ b/src/Pure/Admin/isabelle_cronjob.scala	Sat Oct 22 21:20:55 2022 +0200
@@ -453,9 +453,10 @@
     val hostname: String = Isabelle_System.hostname()
 
     def log(date: Date, task_name: String, msg: String): Unit =
-      if (task_name != "")
+      if (task_name != "") {
         thread.send(
           "[" + Build_Log.print_date(date) + ", " + hostname + ", " + task_name + "]: " + msg)
+      }
 
     def start_logger(start_date: Date, task_name: String): Logger =
       new Logger(this, start_date, task_name)
@@ -537,8 +538,7 @@
     /* structured tasks */
 
     def SEQ(tasks: List[Logger_Task]): Logger_Task = Logger_Task(body = _ =>
-      for (task <- tasks.iterator if !exclude_task(task.name) || task.name == "")
-        run_now(task))
+      for (task <- tasks.iterator if !exclude_task(task.name) || task.name == "") run_now(task))
 
     def PAR(tasks: List[Logger_Task]): Logger_Task =
       Logger_Task(body =