src/Pure/Admin/build_history.scala
changeset 64194 b5ada7dcceaa
parent 64193 7a7e370e2523
child 64213 b265dd04d57d
equal deleted inserted replaced
64193:7a7e370e2523 64194:b5ada7dcceaa
    99   private val default_threads = 1
    99   private val default_threads = 1
   100   private val default_heap = 1000
   100   private val default_heap = 1000
   101   private val default_isabelle_identifier = "build_history"
   101   private val default_isabelle_identifier = "build_history"
   102 
   102 
   103   def build_history(
   103   def build_history(
   104     progress: Progress,
       
   105     hg: Mercurial.Repository,
   104     hg: Mercurial.Repository,
       
   105     progress: Progress = Ignore_Progress,
   106     rev: String = default_rev,
   106     rev: String = default_rev,
   107     isabelle_identifier: String = default_isabelle_identifier,
   107     isabelle_identifier: String = default_isabelle_identifier,
   108     components_base: String = "",
   108     components_base: String = "",
   109     fresh: Boolean = false,
   109     fresh: Boolean = false,
   110     nonfree: Boolean = false,
   110     nonfree: Boolean = false,
   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_args: List[String] = Nil): List[Process_Result] =
   118     build_args: List[String] = Nil): List[(Process_Result, Path)] =
   119   {
   119   {
   120     /* sanity checks */
   120     /* sanity checks */
   121 
   121 
   122     if (File.eq(Path.explode("~~").file, hg.root.file))
   122     if (File.eq(Path.explode("~~").file, hg.root.file))
   123       error("Repository coincides with ISABELLE_HOME=" + Path.explode("~~").expand)
   123       error("Repository coincides with ISABELLE_HOME=" + Path.explode("~~").expand)
   230         terminate_lines(
   230         terminate_lines(
   231           Build_Log.Log_File.print_props(META_INFO_MARKER, meta_info) :: res.out_lines :::
   231           Build_Log.Log_File.print_props(META_INFO_MARKER, meta_info) :: res.out_lines :::
   232           ml_statistics.map(Build_Log.Log_File.print_props(Build_Log.ML_STATISTICS_MARKER, _)) :::
   232           ml_statistics.map(Build_Log.Log_File.print_props(Build_Log.ML_STATISTICS_MARKER, _)) :::
   233           heap_sizes))
   233           heap_sizes))
   234 
   234 
   235       Output.writeln(log_path.implode, stdout = true)
       
   236 
       
   237 
   235 
   238       /* next build */
   236       /* next build */
   239 
   237 
   240       if (multicore_base && first_build && isabelle_output_log.is_dir)
   238       if (multicore_base && first_build && isabelle_output_log.is_dir)
   241         Isabelle_System.copy_dir(isabelle_output_log, isabelle_base_log)
   239         Isabelle_System.copy_dir(isabelle_output_log, isabelle_base_log)
   242 
   240 
   243       first_build = false
   241       first_build = false
   244 
   242 
   245       res
   243       (res, log_path)
   246     }
   244     }
   247   }
   245   }
   248 
   246 
   249 
   247 
   250   /* command line entry point */
   248   /* command line entry point */
   311         }
   309         }
   312 
   310 
   313       val hg = Mercurial.repository(Path.explode(root))
   311       val hg = Mercurial.repository(Path.explode(root))
   314       val progress = new Console_Progress(stderr = true)
   312       val progress = new Console_Progress(stderr = true)
   315       val results =
   313       val results =
   316         build_history(progress, hg, rev = rev, isabelle_identifier = isabelle_identifier,
   314         build_history(hg, progress = progress, rev = rev, isabelle_identifier = isabelle_identifier,
   317           components_base = components_base, fresh = fresh, nonfree = nonfree,
   315           components_base = components_base, fresh = fresh, nonfree = nonfree,
   318           multicore_base = multicore_base, threads_list = threads_list, arch_64 = arch_64,
   316           multicore_base = multicore_base, threads_list = threads_list, arch_64 = arch_64,
   319           heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap),
   317           heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap),
   320           max_heap = max_heap, more_settings = more_settings, verbose = verbose,
   318           max_heap = max_heap, more_settings = more_settings, verbose = verbose,
   321           build_args = build_args)
   319           build_args = build_args)
   322 
   320 
   323       val rc = (0 /: results) { case (rc, res) => rc max res.rc }
   321       for ((_, log_path) <- results)
       
   322         Output.writeln(log_path.implode, stdout = true)
       
   323 
       
   324       val rc = (0 /: results) { case (rc, (res, _)) => rc max res.rc }
   324       if (rc != 0) sys.exit(rc)
   325       if (rc != 0) sys.exit(rc)
   325     }
   326     }
   326   }
   327   }
   327 }
   328 }