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