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