src/Pure/Tools/build.scala
changeset 72637 fd68c9c1b90b
parent 72634 5cea0993ee4f
child 72638 2a7fc87495e0
equal deleted inserted replaced
72636:09ee9eb7a3d3 72637:fd68c9c1b90b
   168 
   168 
   169     private val future_result: Future[Process_Result] =
   169     private val future_result: Future[Process_Result] =
   170       Future.thread("build", uninterruptible = true) {
   170       Future.thread("build", uninterruptible = true) {
   171         val parent = info.parent.getOrElse("")
   171         val parent = info.parent.getOrElse("")
   172         val base = deps(parent)
   172         val base = deps(parent)
   173         val args_yxml =
       
   174           YXML.string_of_body(
       
   175             {
       
   176               import XML.Encode._
       
   177               pair(list(pair(string, int)), pair(list(properties), pair(string, pair(string,
       
   178                 pair(string, pair(list(pair(Options.encode, list(pair(string, properties)))),
       
   179                 pair(list(pair(string, properties)),
       
   180                 pair(list(pair(string, string)),
       
   181                 pair(list(pair(string, string)),
       
   182                 pair(list(string),
       
   183                 pair(list(pair(string, string)),
       
   184                 pair(list(string), list(pair(string, list(string)))))))))))))))(
       
   185               (Symbol.codes, (command_timings0, (parent, (info.chapter,
       
   186                 (session_name, (info.theories,
       
   187                 (sessions_structure.session_positions,
       
   188                 (sessions_structure.dest_session_directories,
       
   189                 (sessions_structure.session_chapters,
       
   190                 (base.doc_names, (base.global_theories.toList,
       
   191                 (base.loaded_theories.keys, sessions_structure.bibtex_entries)))))))))))))
       
   192             })
       
   193 
   173 
   194         val env =
   174         val env =
   195           Isabelle_System.settings() +
   175           Isabelle_System.settings() +
   196             ("ISABELLE_ML_DEBUGGER" -> options.bool("ML_debugger").toString)
   176             ("ISABELLE_ML_DEBUGGER" -> options.bool("ML_debugger").toString)
   197 
   177 
   205             List("ML_Heap.save_child " +
   185             List("ML_Heap.save_child " +
   206               ML_Syntax.print_string_bytes(File.platform_path(store.output_heap(session_name))))
   186               ML_Syntax.print_string_bytes(File.platform_path(store.output_heap(session_name))))
   207           }
   187           }
   208           else Nil
   188           else Nil
   209 
   189 
   210         val resources = new Resources(sessions_structure, deps(parent))
   190         val resources = new Resources(sessions_structure, base)
   211         val session =
   191         val session =
   212           new Session(options, resources) {
   192           new Session(options, resources) {
   213             override val xml_cache: XML.Cache = store.xml_cache
   193             override val xml_cache: XML.Cache = store.xml_cache
   214             override val xz_cache: XZ.Cache = store.xz_cache
   194             override val xz_cache: XZ.Cache = store.xz_cache
   215           }
   195           }
   354 
   334 
   355         val build_errors =
   335         val build_errors =
   356           Isabelle_Thread.interrupt_handler(_ => process.terminate) {
   336           Isabelle_Thread.interrupt_handler(_ => process.terminate) {
   357             Exn.capture { process.await_startup } match {
   337             Exn.capture { process.await_startup } match {
   358               case Exn.Res(_) =>
   338               case Exn.Res(_) =>
   359                 session.protocol_command("build_session", args_yxml)
   339                 val resources_yxml = resources.init_session_yxml
       
   340                 val args_yxml =
       
   341                   YXML.string_of_body(
       
   342                     {
       
   343                       import XML.Encode._
       
   344                       pair(list(properties), pair(string, pair(string, pair(string,
       
   345                         list(pair(Options.encode, list(pair(string, properties))))))))(
       
   346                         (command_timings0, (parent, (info.chapter, (session_name, info.theories)))))
       
   347                     })
       
   348                 session.protocol_command("build_session", resources_yxml, args_yxml)
   360                 Build_Session_Errors.result
   349                 Build_Session_Errors.result
   361               case Exn.Exn(exn) => Exn.Res(List(Exn.message(exn)))
   350               case Exn.Exn(exn) => Exn.Res(List(Exn.message(exn)))
   362             }
   351             }
   363           }
   352           }
   364 
   353