src/Pure/System/build.ML
author wenzelm
Sat, 21 Jul 2012 16:41:55 +0200
changeset 48418 1a634f9614fb
child 48419 6d7b6e47f3ef
permissions -rw-r--r--
some actual build function on ML side; further imitation of "usedir" shell script;

(*  Title:      Pure/System/build.ML
    Author:     Makarius

Build Isabelle sessions.
*)

signature BUILD =
sig
  val build: string -> unit
end;

structure Build: BUILD =
struct

fun build args_file =
  let
    val (build_images, (parent, (name, theories))) =
      File.read (Path.explode args_file) |> YXML.parse_body |>
        let open XML.Decode in pair bool (pair string (pair string (list string))) end;

    val _ = Session.init false parent name;  (* FIXME reset!? *)
    val _ = Thy_Info.use_thys theories;
    val _ = Session.finish ();

    val _ = if build_images then () else quit ();
  in () end
  handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);

end;