src/Pure/Tools/build.scala
changeset 62944 3ee643c5ed00
parent 62902 3c0f53eae166
child 62946 9f537dd83677
equal deleted inserted replaced
62943:659a8737501d 62944:3ee643c5ed00
   256       Isabelle_System.settings() +
   256       Isabelle_System.settings() +
   257         ("ISABELLE_ML_DEBUGGER" -> info.options.bool("ML_debugger").toString)
   257         ("ISABELLE_ML_DEBUGGER" -> info.options.bool("ML_debugger").toString)
   258 
   258 
   259     private val future_result: Future[Process_Result] =
   259     private val future_result: Future[Process_Result] =
   260       Future.thread("build") {
   260       Future.thread("build") {
       
   261         val args_file = Isabelle_System.tmp_file("build")
       
   262         File.write(args_file, YXML.string_of_body(
       
   263             {
       
   264               val theories = info.theories.map(x => (x._2, x._3))
       
   265               import XML.Encode._
       
   266               pair(list(pair(string, int)), pair(list(properties), pair(bool, pair(bool,
       
   267                 pair(Path.encode, pair(list(pair(Path.encode, Path.encode)), pair(string,
       
   268                 pair(string, pair(string, pair(string,
       
   269                 list(pair(Options.encode, list(Path.encode)))))))))))))(
       
   270               (Symbol.codes, (command_timings, (do_output, (verbose,
       
   271                 (store.browser_info, (info.document_files, (File.standard_path(graph_file),
       
   272                 (parent, (info.chapter, (name,
       
   273                 theories)))))))))))
       
   274             }))
       
   275 
       
   276         val eval =
       
   277           "Command_Line.tool0 (fn () => (" +
       
   278           "Build.build " + ML_Syntax.print_string0(File.standard_path(args_file)) +
       
   279           (if (do_output) "; ML_Heap.share_common_data (); " + output_save_state
       
   280            else "") + "));"
   261         val process =
   281         val process =
   262           if (Sessions.pure_name(name)) {
   282           if (Sessions.pure_name(name)) {
   263             val roots = Sessions.pure_roots.flatMap(root => List("--use", root))
   283             ML_Process(info.options, raw_ml_system = true, cwd = info.dir.file,
   264             val eval =
   284               args = List("--use", "ROOT0.ML", "--use", "ROOT.ML", "--eval", eval),
   265               "Command_Line.tool0 (fn () => (Session.finish (); Options.reset_default ();" +
   285               env = env, tree = Some(tree), store = store, cleanup = () => args_file.delete)
   266               " Session.shutdown (); ML_Heap.share_common_data (); " + output_save_state + "));"
       
   267             ML_Process(info.options,
       
   268               raw_ml_system = true, args = roots ::: List("--eval", eval),
       
   269               cwd = info.dir.file, env = env, tree = Some(tree), store = store)
       
   270           }
   286           }
   271           else {
   287           else {
   272             val args_file = Isabelle_System.tmp_file("build")
       
   273             File.write(args_file, YXML.string_of_body(
       
   274                 {
       
   275                   val theories = info.theories.map(x => (x._2, x._3))
       
   276                   import XML.Encode._
       
   277                   pair(list(pair(string, int)), pair(list(properties), pair(bool, pair(bool,
       
   278                     pair(Path.encode, pair(list(pair(Path.encode, Path.encode)), pair(string,
       
   279                     pair(string, pair(string, pair(string,
       
   280                     list(pair(Options.encode, list(Path.encode)))))))))))))(
       
   281                   (Symbol.codes, (command_timings, (do_output, (verbose,
       
   282                     (store.browser_info, (info.document_files, (File.standard_path(graph_file),
       
   283                     (parent, (info.chapter, (name,
       
   284                     theories)))))))))))
       
   285                 }))
       
   286             val eval =
       
   287               "Command_Line.tool0 (fn () => (" +
       
   288               "Build.build " + ML_Syntax.print_string0(File.standard_path(args_file)) +
       
   289               (if (do_output) "; ML_Heap.share_common_data (); " + output_save_state
       
   290                else "") + "));"
       
   291             ML_Process(info.options, parent, List("--eval", eval), cwd = info.dir.file,
   288             ML_Process(info.options, parent, List("--eval", eval), cwd = info.dir.file,
   292               env = env, tree = Some(tree), store = store, cleanup = () => args_file.delete)
   289               env = env, tree = Some(tree), store = store, cleanup = () => args_file.delete)
   293           }
   290           }
   294         process.result(
   291         process.result(
   295           progress_stdout = (line: String) =>
   292           progress_stdout = (line: String) =>
   318 
   315 
   319     def join: Process_Result =
   316     def join: Process_Result =
   320     {
   317     {
   321       val result = future_result.join
   318       val result = future_result.join
   322 
   319 
   323       if (result.ok && !Sessions.pure_name(name))
   320       if (result.ok)
   324         Present.finish(progress, store.browser_info, graph_file, info, name)
   321         Present.finish(progress, store.browser_info, graph_file, info, name)
   325 
   322 
   326       graph_file.delete
   323       graph_file.delete
   327       timeout_request.foreach(_.cancel)
   324       timeout_request.foreach(_.cancel)
   328 
   325 
   675 
   672 
   676     if (!no_build) {
   673     if (!no_build) {
   677       val browser_chapters =
   674       val browser_chapters =
   678         (for {
   675         (for {
   679           (name, result) <- results0.iterator
   676           (name, result) <- results0.iterator
   680           if result.ok && !Sessions.pure_name(name)
   677           if result.ok
   681           info = full_tree(name)
   678           info = full_tree(name)
   682           if info.options.bool("browser_info")
   679           if info.options.bool("browser_info")
   683         } yield (info.chapter, (name, info.description))).toList.groupBy(_._1).
   680         } yield (info.chapter, (name, info.description))).toList.groupBy(_._1).
   684             map({ case (chapter, es) => (chapter, es.map(_._2)) }).filterNot(_._2.isEmpty)
   681             map({ case (chapter, es) => (chapter, es.map(_._2)) }).filterNot(_._2.isEmpty)
   685 
   682