src/Pure/Tools/build_job.scala
changeset 77521 5642de4d225d
parent 77509 3bc49507bae5
child 77529 40ccee0fe19a
equal deleted inserted replaced
77520:84aa349ed597 77521:5642de4d225d
   112     session_background: Sessions.Background,
   112     session_background: Sessions.Background,
   113     input_shasum: SHA1.Shasum,
   113     input_shasum: SHA1.Shasum,
   114     override val node_info: Host.Node_Info
   114     override val node_info: Host.Node_Info
   115   ) extends Build_Job {
   115   ) extends Build_Job {
   116     private val store = build_context.store
   116     private val store = build_context.store
   117     private val verbose = build_context.verbose
       
   118 
   117 
   119     def session_name: String = session_background.session_name
   118     def session_name: String = session_background.session_name
   120     def job_name: String = session_name
   119     def job_name: String = session_name
   121 
   120 
   122     private val info: Sessions.Info = session_background.sessions_structure(session_name)
   121     private val info: Sessions.Info = session_background.sessions_structure(session_name)
   503 
   502 
   504         // messages
   503         // messages
   505         process_result.err_lines.foreach(progress.echo(_))
   504         process_result.err_lines.foreach(progress.echo(_))
   506 
   505 
   507         if (process_result.ok) {
   506         if (process_result.ok) {
   508           if (verbose) {
   507           val props = build_log.session_timing
   509             val props = build_log.session_timing
   508           val threads = Markup.Session_Timing.Threads.unapply(props) getOrElse 1
   510             val threads = Markup.Session_Timing.Threads.unapply(props) getOrElse 1
   509           val timing = Markup.Timing_Properties.get(props)
   511             val timing = Markup.Timing_Properties.get(props)
   510           progress.echo(
   512             progress.echo(
   511             "Timing " + session_name + " (" + threads + " threads, " + timing.message_factor + ")",
   513               "Timing " + session_name + " (" + threads + " threads, " + timing.message_factor + ")")
   512             verbose = true)
   514           }
       
   515           progress.echo(
   513           progress.echo(
   516             "Finished " + session_name + " (" + process_result.timing.message_resources + ")")
   514             "Finished " + session_name + " (" + process_result.timing.message_resources + ")")
   517         }
   515         }
   518         else {
   516         else {
   519           progress.echo(
   517           progress.echo(
   611     options: Options,
   609     options: Options,
   612     sessions: List[String],
   610     sessions: List[String],
   613     theories: List[String] = Nil,
   611     theories: List[String] = Nil,
   614     message_head: List[Regex] = Nil,
   612     message_head: List[Regex] = Nil,
   615     message_body: List[Regex] = Nil,
   613     message_body: List[Regex] = Nil,
   616     verbose: Boolean = false,
       
   617     progress: Progress = new Progress,
   614     progress: Progress = new Progress,
   618     margin: Double = Pretty.default_margin,
   615     margin: Double = Pretty.default_margin,
   619     breakgain: Double = Pretty.default_breakgain,
   616     breakgain: Double = Pretty.default_breakgain,
   620     metric: Pretty.Metric = Symbol.Metric,
   617     metric: Pretty.Metric = Symbol.Metric,
   621     unicode_symbols: Boolean = false
   618     unicode_symbols: Boolean = false
   655                 case None => progress.echo(thy_heading + " MISSING")
   652                 case None => progress.echo(thy_heading + " MISSING")
   656                 case Some(snapshot) =>
   653                 case Some(snapshot) =>
   657                   val rendering = new Rendering(snapshot, options, session)
   654                   val rendering = new Rendering(snapshot, options, session)
   658                   val messages =
   655                   val messages =
   659                     rendering.text_messages(Text.Range.full)
   656                     rendering.text_messages(Text.Range.full)
   660                       .filter(message => verbose || Protocol.is_exported(message.info))
   657                       .filter(message => progress.verbose || Protocol.is_exported(message.info))
   661                   if (messages.nonEmpty) {
   658                   if (messages.nonEmpty) {
   662                     val line_document = Line.Document(snapshot.node.source)
   659                     val line_document = Line.Document(snapshot.node.source)
   663                     val buffer = new mutable.ListBuffer[String]
   660                     val buffer = new mutable.ListBuffer[String]
   664                     for (Text.Info(range, elem) <- messages) {
   661                     for (Text.Info(range, elem) <- messages) {
   665                       val line = line_document.position(range.start).line1
   662                       val line = line_document.position(range.start).line1
   745         "o:" -> (arg => options = options + arg),
   742         "o:" -> (arg => options = options + arg),
   746         "v" -> (_ => verbose = true))
   743         "v" -> (_ => verbose = true))
   747 
   744 
   748       val sessions = getopts(args)
   745       val sessions = getopts(args)
   749 
   746 
   750       val progress = new Console_Progress()
   747       val progress = new Console_Progress(verbose = verbose)
   751 
   748 
   752       if (sessions.isEmpty) progress.echo_warning("No sessions to print")
   749       if (sessions.isEmpty) progress.echo_warning("No sessions to print")
   753       else {
   750       else {
   754         print_log(options, sessions, theories = theories, message_head = message_head,
   751         print_log(options, sessions, theories = theories, message_head = message_head,
   755           message_body = message_body, verbose = verbose, margin = margin, progress = progress,
   752           message_body = message_body, margin = margin, progress = progress,
   756           unicode_symbols = unicode_symbols)
   753           unicode_symbols = unicode_symbols)
   757       }
   754       }
   758     })
   755     })
   759 }
   756 }