src/Pure/Admin/build_log.scala
changeset 64298 0f000101652a
parent 64297 12a47f263122
child 64299 4f11063c6e55
     1.1 --- a/src/Pure/Admin/build_log.scala	Tue Oct 18 11:50:38 2016 +0200
     1.2 +++ b/src/Pure/Admin/build_log.scala	Tue Oct 18 13:44:54 2016 +0200
     1.3 @@ -18,36 +18,25 @@
     1.4  
     1.5  object Build_Log
     1.6  {
     1.7 -  /** directory content **/
     1.8 +  /** content **/
     1.9  
    1.10 -  /* file names */
    1.11 +  /* properties */
    1.12  
    1.13 -  def log_date(date: Date): String =
    1.14 -    String.format(Locale.ROOT, "%s.%05d",
    1.15 -      DateTimeFormatter.ofPattern("yyyy-MM-dd").format(date.rep),
    1.16 -      new java.lang.Long((date.time - date.midnight.time).ms / 1000))
    1.17 -
    1.18 -  def log_subdir(date: Date): Path =
    1.19 -    Path.explode("log") + Path.explode(date.rep.getYear.toString)
    1.20 -
    1.21 -  def log_filename(engine: String, date: Date, more: List[String] = Nil): Path =
    1.22 -    Path.explode((engine :: log_date(date) :: more).mkString("", "_", ".log"))
    1.23 +  object Prop
    1.24 +  {
    1.25 +    val build_tags = "build_tags"
    1.26 +    val build_group_id = "build_group_id"
    1.27 +    val build_id = "build_id"
    1.28 +    val build_engine = "build_engine"
    1.29 +    val build_host = "build_host"
    1.30 +    val build_start = "build_start"
    1.31 +    val build_end = "build_end"
    1.32 +    val isabelle_version = "isabelle_version"
    1.33 +    val afp_version = "afp_version"
    1.34 +  }
    1.35  
    1.36  
    1.37 -  /* log file collections */
    1.38 -
    1.39 -  def is_log(file: JFile): Boolean =
    1.40 -    List(".log", ".log.gz", ".log.xz").exists(ext => file.getName.endsWith(ext))
    1.41 -
    1.42 -  def isatest_files(dir: Path): List[JFile] =
    1.43 -    File.find_files(dir.file, file => is_log(file) && file.getName.startsWith("isatest-makeall-"))
    1.44 -
    1.45 -  def afp_test_files(dir: Path): List[JFile] =
    1.46 -    File.find_files(dir.file, file => is_log(file) && file.getName.startsWith("afp-test-devel-"))
    1.47 -
    1.48 -
    1.49 -
    1.50 -  /** settings **/
    1.51 +  /* settings */
    1.52  
    1.53    object Settings
    1.54    {
    1.55 @@ -78,6 +67,32 @@
    1.56    }
    1.57  
    1.58  
    1.59 +  /* file names */
    1.60 +
    1.61 +  def log_date(date: Date): String =
    1.62 +    String.format(Locale.ROOT, "%s.%05d",
    1.63 +      DateTimeFormatter.ofPattern("yyyy-MM-dd").format(date.rep),
    1.64 +      new java.lang.Long((date.time - date.midnight.time).ms / 1000))
    1.65 +
    1.66 +  def log_subdir(date: Date): Path =
    1.67 +    Path.explode("log") + Path.explode(date.rep.getYear.toString)
    1.68 +
    1.69 +  def log_filename(engine: String, date: Date, more: List[String] = Nil): Path =
    1.70 +    Path.explode((engine :: log_date(date) :: more).mkString("", "_", ".log"))
    1.71 +
    1.72 +
    1.73 +  /* log file collections */
    1.74 +
    1.75 +  def is_log(file: JFile): Boolean =
    1.76 +    List(".log", ".log.gz", ".log.xz").exists(ext => file.getName.endsWith(ext))
    1.77 +
    1.78 +  def isatest_files(dir: Path): List[JFile] =
    1.79 +    File.find_files(dir.file, file => is_log(file) && file.getName.startsWith("isatest-makeall-"))
    1.80 +
    1.81 +  def afp_test_files(dir: Path): List[JFile] =
    1.82 +    File.find_files(dir.file, file => is_log(file) && file.getName.startsWith("afp-test-devel-"))
    1.83 +
    1.84 +
    1.85  
    1.86    /** log file **/
    1.87  
    1.88 @@ -245,19 +260,6 @@
    1.89  
    1.90    /** meta info **/
    1.91  
    1.92 -  object Field
    1.93 -  {
    1.94 -    val build_tags = "build_tags"
    1.95 -    val build_group_id = "build_group_id"
    1.96 -    val build_id = "build_id"
    1.97 -    val build_engine = "build_engine"
    1.98 -    val build_host = "build_host"
    1.99 -    val build_start = "build_start"
   1.100 -    val build_end = "build_end"
   1.101 -    val isabelle_version = "isabelle_version"
   1.102 -    val afp_version = "afp_version"
   1.103 -  }
   1.104 -
   1.105    object Meta_Info
   1.106    {
   1.107      val empty: Meta_Info = Meta_Info(Nil, Nil)
   1.108 @@ -311,23 +313,23 @@
   1.109          val prefix = if (host != "") host else if (engine != "") engine else ""
   1.110          (if (prefix == "") "build" else prefix) + ":" + start.time.ms
   1.111        }
   1.112 -      val build_engine = if (engine == "") Nil else List(Field.build_engine -> engine)
   1.113 -      val build_host = if (host == "") Nil else List(Field.build_host -> host)
   1.114 +      val build_engine = if (engine == "") Nil else List(Prop.build_engine -> engine)
   1.115 +      val build_host = if (host == "") Nil else List(Prop.build_host -> host)
   1.116  
   1.117 -      val start_date = List(Field.build_start -> start.toString)
   1.118 +      val start_date = List(Prop.build_start -> start.toString)
   1.119        val end_date =
   1.120          log_file.lines.last match {
   1.121            case End(log_file.Strict_Date(end_date)) =>
   1.122 -            List(Field.build_end -> end_date.toString)
   1.123 +            List(Prop.build_end -> end_date.toString)
   1.124            case _ => Nil
   1.125          }
   1.126  
   1.127        val isabelle_version =
   1.128 -        log_file.find_match(Isabelle_Version).map(Field.isabelle_version -> _)
   1.129 +        log_file.find_match(Isabelle_Version).map(Prop.isabelle_version -> _)
   1.130        val afp_version =
   1.131 -        log_file.find_match(AFP_Version).map(Field.afp_version -> _)
   1.132 +        log_file.find_match(AFP_Version).map(Prop.afp_version -> _)
   1.133  
   1.134 -      Meta_Info((Field.build_id -> build_id) :: build_engine ::: build_host :::
   1.135 +      Meta_Info((Prop.build_id -> build_id) :: build_engine ::: build_host :::
   1.136            start_date ::: end_date ::: isabelle_version.toList ::: afp_version.toList,
   1.137          log_file.get_settings(Settings.all_settings))
   1.138      }