src/Pure/System/build.ML
author wenzelm
Tue, 24 Jul 2012 00:29:36 +0200
changeset 49472 fd9e28d5a143
parent 49434 6d7b6e47f3ef
child 49473 09710d6fc3d1
permissions -rw-r--r--
pass build options to ML;
some imitation of usedir Session.init;
     1 (*  Title:      Pure/System/build.ML
     2     Author:     Makarius
     3 
     4 Build Isabelle sessions.
     5 *)
     6 
     7 signature BUILD =
     8 sig
     9   val build: string -> unit
    10 end;
    11 
    12 structure Build: BUILD =
    13 struct
    14 
    15 fun use_theories name options =
    16   Thy_Info.use_thys
    17     |> Session.with_timing name (Options.bool options "timing")
    18     |> Unsynchronized.setmp Proofterm.proofs (Options.int options "proofs")
    19     |> Unsynchronized.setmp print_mode
    20         (space_explode "," (Options.string options "print_mode") @ print_mode_value ())
    21     |> Unsynchronized.setmp Goal.parallel_proofs (Options.int options "parallel_proofs")
    22     |> Unsynchronized.setmp Goal.parallel_proofs_threshold
    23         (Options.int options "parallel_proofs_threshold")
    24     |> Unsynchronized.setmp Multithreading.trace (Options.int options "threads_trace")
    25     |> Unsynchronized.setmp Multithreading.max_threads (Options.int options "threads_limit");
    26 
    27 fun build args_file =
    28   let
    29     val (save, (options, (verbose, (browser_info, (parent, (name, (base_name, theories))))))) =
    30       File.read (Path.explode args_file) |> YXML.parse_body |>
    31         let open XML.Decode in
    32           pair bool (pair Options.decode (pair bool (pair string (pair string
    33             (pair string (pair string ((list (pair Options.decode (list string))))))))))
    34         end;
    35 
    36     val _ =
    37       Session.init
    38         save
    39         false (* FIXME reset!? *)
    40         (Options.bool options "browser_info") browser_info
    41         (Options.string options "document_format")   (* FIXME dependent on "document" (!?) *)
    42         (Options.bool options "document_graph")
    43         (space_explode "," (Options.string options "document_variants"))
    44         parent
    45         base_name
    46         (true (* FIXME copy document/ files on Scala side!? *),
    47           Options.string options "document_dump")
    48         ""
    49         verbose;
    50 
    51     val _ = List.app (uncurry (use_theories name)) theories;
    52     val _ = Session.finish ();
    53 
    54     val _ = if save then () else quit ();
    55   in () end
    56   handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);
    57 
    58 end;