src/Pure/Tools/build.scala
changeset 70683 8c7706b053c7
parent 70671 cb1776c8e216
child 70712 a3cfe859d915
equal deleted inserted replaced
70682:4c53227f4b73 70683:8c7706b053c7
   195     val numa_node: Option[Int],
   195     val numa_node: Option[Int],
   196     command_timings: List[Properties.T])
   196     command_timings: List[Properties.T])
   197   {
   197   {
   198     val options = NUMA.policy_options(info.options, numa_node)
   198     val options = NUMA.policy_options(info.options, numa_node)
   199 
   199 
       
   200     val sessions_structure = deps.sessions_structure
       
   201 
   200     private val graph_file = Isabelle_System.tmp_file("session_graph", "pdf")
   202     private val graph_file = Isabelle_System.tmp_file("session_graph", "pdf")
   201     isabelle.graphview.Graph_File.write(options, graph_file, deps(name).session_graph_display)
   203     isabelle.graphview.Graph_File.write(options, graph_file, deps(name).session_graph_display)
   202 
   204 
   203     private val export_tmp_dir = Isabelle_System.tmp_dir("export")
   205     private val export_tmp_dir = Isabelle_System.tmp_dir("export")
   204     private val export_consumer =
   206     private val export_consumer =
   214               import XML.Encode._
   216               import XML.Encode._
   215               pair(list(pair(string, int)), pair(list(properties), pair(bool, pair(bool,
   217               pair(list(pair(string, int)), pair(list(properties), pair(bool, pair(bool,
   216                 pair(Path.encode, pair(list(pair(Path.encode, Path.encode)), pair(string,
   218                 pair(Path.encode, pair(list(pair(Path.encode, Path.encode)), pair(string,
   217                 pair(string, pair(string, pair(string, pair(Path.encode,
   219                 pair(string, pair(string, pair(string, pair(Path.encode,
   218                 pair(list(pair(Options.encode, list(pair(string, properties)))),
   220                 pair(list(pair(Options.encode, list(pair(string, properties)))),
   219                 pair(list(pair(string, properties)), pair(list(string),
   221                 pair(list(pair(string, properties)),
   220                 pair(list(pair(string, string)),
   222                 pair(list(pair(string, string)),
   221                 pair(list(string), pair(list(pair(string, string)), list(string))))))))))))))))))(
   223                 pair(list(string), pair(list(pair(string, string)),
       
   224                 pair(list(string), pair(list(pair(string, string)), list(string)))))))))))))))))))(
   222               (Symbol.codes, (command_timings, (do_output, (verbose,
   225               (Symbol.codes, (command_timings, (do_output, (verbose,
   223                 (store.browser_info, (info.document_files, (File.standard_path(graph_file),
   226                 (store.browser_info, (info.document_files, (File.standard_path(graph_file),
   224                 (parent, (info.chapter, (name, (Path.current,
   227                 (parent, (info.chapter, (name, (Path.current,
   225                 (info.theories, (base.known.sessions.toList, (base.doc_names,
   228                 (info.theories,
   226                 (base.global_theories.toList, (base.loaded_theories.keys, (base.dest_known_theories,
   229                 (sessions_structure.session_positions,
   227                 info.bibtex_entries.map(_.info)))))))))))))))))))
   230                 (sessions_structure.dest_session_directories,
       
   231                 (base.doc_names, (base.global_theories.toList,
       
   232                 (base.loaded_theories.keys, (base.dest_known_theories,
       
   233                 info.bibtex_entries.map(_.info))))))))))))))))))))
   228             })
   234             })
   229 
   235 
   230         val env =
   236         val env =
   231           Isabelle_System.settings() +
   237           Isabelle_System.settings() +
   232             ("ISABELLE_EXPORT_TMP" -> File.standard_path(export_tmp_dir)) +
   238             ("ISABELLE_EXPORT_TMP" -> File.standard_path(export_tmp_dir)) +
   236           (if (info.theories.isEmpty) "" else "ML_Heap.share_common_data (); ") +
   242           (if (info.theories.isEmpty) "" else "ML_Heap.share_common_data (); ") +
   237             "ML_Heap.save_child " +
   243             "ML_Heap.save_child " +
   238             ML_Syntax.print_string_bytes(File.platform_path(store.output_heap(name)))
   244             ML_Syntax.print_string_bytes(File.platform_path(store.output_heap(name)))
   239 
   245 
   240         if (pide && !Sessions.is_pure(name)) {
   246         if (pide && !Sessions.is_pure(name)) {
   241           val resources = new Resources(deps(parent))
   247           val resources = new Resources(sessions_structure, deps(parent))
   242           val session = new Session(options, resources)
   248           val session = new Session(options, resources)
   243           val handler = new Handler(progress, session, name)
   249           val handler = new Handler(progress, session, name)
   244           session.init_protocol_handler(handler)
   250           session.init_protocol_handler(handler)
   245 
   251 
   246           val session_result = Future.promise[Process_Result]
   252           val session_result = Future.promise[Process_Result]
   247 
   253 
   248           Isabelle_Process.start(session, options, logic = parent, cwd = info.dir.file, env = env,
   254           Isabelle_Process.start(session, options, logic = parent, cwd = info.dir.file, env = env,
   249             sessions_structure = Some(deps.sessions_structure), store = Some(store),
   255             sessions_structure = Some(sessions_structure), store = Some(store),
   250             phase_changed =
   256             phase_changed =
   251             {
   257             {
   252               case Session.Ready => session.protocol_command("build_session", args_yxml)
   258               case Session.Ready => session.protocol_command("build_session", args_yxml)
   253               case Session.Terminated(result) => session_result.fulfill(result)
   259               case Session.Terminated(result) => session_result.fulfill(result)
   254               case _ =>
   260               case _ =>