src/Pure/Admin/build_history.scala
changeset 64297 12a47f263122
parent 64296 544481988e65
child 64298 0f000101652a
equal deleted inserted replaced
64296:544481988e65 64297:12a47f263122
   113     arch_64: Boolean = false,
   113     arch_64: Boolean = false,
   114     heap: Int = default_heap,
   114     heap: Int = default_heap,
   115     max_heap: Option[Int] = None,
   115     max_heap: Option[Int] = None,
   116     more_settings: List[String] = Nil,
   116     more_settings: List[String] = Nil,
   117     verbose: Boolean = false,
   117     verbose: Boolean = false,
       
   118     build_tags: List[String] = Nil,
   118     build_args: List[String] = Nil): List[(Process_Result, Path)] =
   119     build_args: List[String] = Nil): List[(Process_Result, Path)] =
   119   {
   120   {
   120     /* sanity checks */
   121     /* sanity checks */
   121 
   122 
   122     if (File.eq(Path.explode("~~"), hg.root))
   123     if (File.eq(Path.explode("~~"), hg.root))
   189       val build_end = Date.now()
   190       val build_end = Date.now()
   190 
   191 
   191       val log_path =
   192       val log_path =
   192         other_isabelle.isabelle_home_user +
   193         other_isabelle.isabelle_home_user +
   193           Build_Log.log_subdir(build_history_date) +
   194           Build_Log.log_subdir(build_history_date) +
   194           Build_Log.log_filename(
   195           Build_Log.log_filename(BUILD_HISTORY, build_history_date,
   195             BUILD_HISTORY, build_history_date, build_host, ml_platform, "M" + threads)
   196             List(build_host, ml_platform, "M" + threads) ::: build_tags)
   196 
   197 
   197       val build_info =
   198       val build_info =
   198         Build_Log.Log_File(log_path.base.implode, build_result.out_lines).parse_build_info()
   199         Build_Log.Log_File(log_path.base.implode, build_result.out_lines).parse_build_info()
   199 
   200 
   200 
   201 
   201       /* output log */
   202       /* output log */
   202 
   203 
   203       val meta_info =
   204       val meta_info =
       
   205         (if (build_tags.isEmpty) Nil
       
   206          else List(Build_Log.Field.build_tags -> Word.implode(build_tags))) :::
   204         List(
   207         List(
   205           Build_Log.Field.build_group_id -> build_group_id,
   208           Build_Log.Field.build_group_id -> build_group_id,
   206           Build_Log.Field.build_id -> (build_host + ":" + build_start.time.ms),
   209           Build_Log.Field.build_id -> (build_host + ":" + build_start.time.ms),
   207           Build_Log.Field.build_engine -> BUILD_HISTORY,
   210           Build_Log.Field.build_engine -> BUILD_HISTORY,
   208           Build_Log.Field.build_host -> build_host,
   211           Build_Log.Field.build_host -> build_host,
   266       var more_settings: List[String] = Nil
   269       var more_settings: List[String] = Nil
   267       var fresh = false
   270       var fresh = false
   268       var arch_64 = false
   271       var arch_64 = false
   269       var nonfree = false
   272       var nonfree = false
   270       var rev = default_rev
   273       var rev = default_rev
       
   274       var build_tags = List.empty[String]
   271       var verbose = false
   275       var verbose = false
   272 
   276 
   273       val getopts = Getopts("""
   277       val getopts = Getopts("""
   274 Usage: isabelle build_history [OPTIONS] REPOSITORY [ARGS ...]
   278 Usage: isabelle build_history [OPTIONS] REPOSITORY [ARGS ...]
   275 
   279 
   283     -e TEXT      additional text for generated etc/settings
   287     -e TEXT      additional text for generated etc/settings
   284     -f           fresh build of Isabelle/Scala components (recommended)
   288     -f           fresh build of Isabelle/Scala components (recommended)
   285     -m ARCH      processor architecture (32=x86, 64=x86_64, default: x86)
   289     -m ARCH      processor architecture (32=x86, 64=x86_64, default: x86)
   286     -n           include nonfree components
   290     -n           include nonfree components
   287     -r REV       update to revision (default: """ + default_rev + """)
   291     -r REV       update to revision (default: """ + default_rev + """)
       
   292     -t TAG       free-form build tag (multiple occurrences possible)
   288     -v           verbose
   293     -v           verbose
   289 
   294 
   290   Build Isabelle sessions from the history of another REPOSITORY clone,
   295   Build Isabelle sessions from the history of another REPOSITORY clone,
   291   passing ARGS directly to its isabelle build tool.
   296   passing ARGS directly to its isabelle build tool.
   292 """,
   297 """,
   304             case "64" | "x86_64" => arch_64 = true
   309             case "64" | "x86_64" => arch_64 = true
   305             case bad => error("Bad processor architecture: " + quote(bad))
   310             case bad => error("Bad processor architecture: " + quote(bad))
   306           },
   311           },
   307         "n" -> (_ => nonfree = true),
   312         "n" -> (_ => nonfree = true),
   308         "r:" -> (arg => rev = arg),
   313         "r:" -> (arg => rev = arg),
       
   314         "t:" -> (arg => build_tags = build_tags ::: List(arg)),
   309         "v" -> (_ => verbose = true))
   315         "v" -> (_ => verbose = true))
   310 
   316 
   311       val more_args = getopts(args)
   317       val more_args = getopts(args)
   312       val (root, build_args) =
   318       val (root, build_args) =
   313         more_args match {
   319         more_args match {
   321         build_history(hg, progress = progress, rev = rev, isabelle_identifier = isabelle_identifier,
   327         build_history(hg, progress = progress, rev = rev, isabelle_identifier = isabelle_identifier,
   322           components_base = components_base, fresh = fresh, nonfree = nonfree,
   328           components_base = components_base, fresh = fresh, nonfree = nonfree,
   323           multicore_base = multicore_base, threads_list = threads_list, arch_64 = arch_64,
   329           multicore_base = multicore_base, threads_list = threads_list, arch_64 = arch_64,
   324           heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap),
   330           heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap),
   325           max_heap = max_heap, more_settings = more_settings, verbose = verbose,
   331           max_heap = max_heap, more_settings = more_settings, verbose = verbose,
   326           build_args = build_args)
   332           build_tags = build_tags, build_args = build_args)
   327 
   333 
   328       for ((_, log_path) <- results)
   334       for ((_, log_path) <- results)
   329         Output.writeln(log_path.implode, stdout = true)
   335         Output.writeln(log_path.implode, stdout = true)
   330 
   336 
   331       val rc = (0 /: results) { case (rc, (res, _)) => rc max res.rc }
   337       val rc = (0 /: results) { case (rc, (res, _)) => rc max res.rc }