provide Isabelle tool wrapper;
authorwenzelm
Wed, 29 Mar 2023 20:56:43 +0200
changeset 77749 4649c7bfd3f0
parent 77748 5a2a297a91f8
child 77750 a8c52c99fa92
provide Isabelle tool wrapper;
src/Pure/Admin/build_log.scala
src/Pure/System/isabelle_tool.scala
--- a/src/Pure/Admin/build_log.scala	Wed Mar 29 20:41:54 2023 +0200
+++ b/src/Pure/Admin/build_log.scala	Wed Mar 29 20:56:43 2023 +0200
@@ -1146,7 +1146,7 @@
   }
 
 
-  /* maintain build_log database */
+  /** maintain build_log database **/
 
   def build_log_database(options: Options, log_dirs: List[Path],
     progress: Progress = new Progress,
@@ -1186,4 +1186,44 @@
       }
     }
   }
+
+
+  /* Isabelle tool wrapper */
+
+  val isabelle_tool = Isabelle_Tool("build_log_database", "update build_log database from log files",
+    Scala_Project.here,
+    { args =>
+      var ml_statistics: Boolean = false
+      var snapshot: Option[Path] = None
+      var dirs: List[Path] = Nil
+      var options = Options.init()
+      var verbose = false
+
+      val getopts = Getopts("""
+Usage: isabelle build_log_database [OPTIONS]
+
+  Options are:
+    -M           include ML statistics
+    -S FILE      snapshot to SQLite db file
+    -d DIR       include directory with log files
+    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
+    -v           verbose
+
+  Update the build_log database server from log files, recursively collected
+  from given directories.
+""",
+        "M" -> (_ => ml_statistics = true),
+        "S:" -> (arg => snapshot = Some(Path.explode(arg))),
+        "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
+        "o:" -> (arg => options = options + arg),
+        "v" -> (_ => verbose = true))
+
+      val more_args = getopts(args)
+      if (more_args.nonEmpty) getopts.usage()
+
+      val progress = new Console_Progress(verbose = verbose)
+
+      build_log_database(options, dirs, progress = progress,
+        ml_statistics = ml_statistics, snapshot = snapshot)
+    })
 }
--- a/src/Pure/System/isabelle_tool.scala	Wed Mar 29 20:41:54 2023 +0200
+++ b/src/Pure/System/isabelle_tool.scala	Wed Mar 29 20:56:43 2023 +0200
@@ -157,6 +157,7 @@
 
 class Admin_Tools extends Isabelle_Scala_Tools(
   Build_Doc.isabelle_tool,
+  Build_Log.isabelle_tool,
   Build_Status.isabelle_tool,
   Check_Sources.isabelle_tool,
   Component_CSDP.isabelle_tool,