src/Pure/PIDE/document_editor.scala
changeset 77195 e312c7fa3bad
parent 77185 9dc4d9ed886f
child 77197 a541da01ba67
equal deleted inserted replaced
77194:7438d516ab4f 77195:e312c7fa3bad
   144           else Some(snapshot)
   144           else Some(snapshot)
   145         }
   145         }
   146       Session(background, selection, snapshot)
   146       Session(background, selection, snapshot)
   147     }
   147     }
   148   }
   148   }
       
   149 
       
   150 
       
   151   /* build */
       
   152 
       
   153   def build(
       
   154     session_context: Export.Session_Context,
       
   155     document_session: Document_Editor.Session,
       
   156     progress: Progress
       
   157   ): Unit = {
       
   158     val session_background = document_session.get_background
       
   159     val context =
       
   160       Document_Build.context(session_context,
       
   161         document_session = Some(session_background.base),
       
   162         document_selection = document_session.selection,
       
   163         progress = progress)
       
   164 
       
   165     Isabelle_System.make_directory(document_output_dir())
       
   166     Isabelle_System.with_tmp_dir("document") { tmp_dir =>
       
   167       val engine = context.get_engine()
       
   168       val variant = document_session.get_variant
       
   169       val directory = engine.prepare_directory(context, tmp_dir, variant, verbose = true)
       
   170       val ok =
       
   171         Meta_Data.read() match {
       
   172           case Some(meta_data) =>
       
   173             meta_data.check_files() && meta_data.sources == directory.sources
       
   174           case None => false
       
   175         }
       
   176       if (!ok) {
       
   177         write_document(document_session.selection,
       
   178           engine.build_document(context, directory, verbose = true))
       
   179       }
       
   180     }
       
   181   }
   149 }
   182 }