src/Pure/System/build.ML
author wenzelm
Tue, 24 Jul 2012 10:43:13 +0200
changeset 49475 20170ae271a5
parent 49474 375e45df6fdf
child 49476 96c1ef26aabe
permissions -rw-r--r--
tuned options;
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@49472
    38
      Session.init
wenzelm@49472
    39
        save
wenzelm@49472
    40
        false (* FIXME reset!? *)
wenzelm@49472
    41
        (Options.bool options "browser_info") browser_info
wenzelm@49473
    42
        (Options.string options "document")
wenzelm@49472
    43
        (Options.bool options "document_graph")
wenzelm@49472
    44
        (space_explode "," (Options.string options "document_variants"))
wenzelm@49472
    45
        parent
wenzelm@49472
    46
        base_name
wenzelm@49472
    47
        (true (* FIXME copy document/ files on Scala side!? *),
wenzelm@49472
    48
          Options.string options "document_dump")
wenzelm@49472
    49
        ""
wenzelm@49472
    50
        verbose;
wenzelm@49472
    51
wenzelm@49474
    52
    val _ = List.app (uncurry (use_theories |> Session.with_timing name timing)) theories;
wenzelm@49433
    53
    val _ = Session.finish ();
wenzelm@49433
    54
wenzelm@49434
    55
    val _ = if save then () else quit ();
wenzelm@49433
    56
  in () end
wenzelm@49433
    57
  handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);
wenzelm@49433
    58
wenzelm@49433
    59
end;