src/Pure/System/build.ML
author wenzelm
Tue, 24 Jul 2012 12:54:34 +0200
changeset 49487 6ebb6cdd36a5
parent 49485 7483aa690b4f
child 49492 322fbf571782
permissions -rw-r--r--
actually negate "document" (cf. 7483aa690b4f);
     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 local
    16 
    17 fun use_thys options =
    18   Thy_Info.use_thys
    19     |> Unsynchronized.setmp Proofterm.proofs (Options.int options "proofs")
    20     |> Unsynchronized.setmp print_mode
    21         (space_explode "," (Options.string options "print_mode") @ print_mode_value ())
    22     |> Unsynchronized.setmp Goal.parallel_proofs (Options.int options "parallel_proofs")
    23     |> Unsynchronized.setmp Goal.parallel_proofs_threshold
    24         (Options.int options "parallel_proofs_threshold")
    25     |> Unsynchronized.setmp Multithreading.trace (Options.int options "threads_trace")
    26     |> Unsynchronized.setmp Multithreading.max_threads (Options.int options "threads")
    27     |> (case Options.string options "document" of "" => true | "false" => true | _ => false) ?
    28         Present.no_document
    29     |> Unsynchronized.setmp quick_and_dirty (Options.bool options "quick_and_dirty");
    30 
    31 fun use_theories (options, thys) =
    32   let val condition = space_explode "," (Options.string options "condition") in
    33     (case filter_out (can getenv_strict) condition of
    34       [] => use_thys options thys
    35     | conds =>
    36         Output.physical_stderr ("Ignoring theories " ^ commas_quote thys ^
    37           " (missing " ^ commas conds ^ ")\n"))
    38   end;
    39 
    40 in
    41 
    42 fun build args_file =
    43   let
    44     val (save, (options, (timing, (verbose, (browser_info, (parent,
    45         (name, (base_name, theories)))))))) =
    46       File.read (Path.explode args_file) |> YXML.parse_body |>
    47         let open XML.Decode in
    48           pair bool (pair Options.decode (pair bool (pair bool (pair string (pair string
    49             (pair string (pair string ((list (pair Options.decode (list string)))))))))))
    50         end;
    51 
    52     val _ =
    53       Session.init save false
    54         (Options.bool options "browser_info") browser_info
    55         (Options.string options "document")
    56         (Options.bool options "document_graph")
    57         (space_explode ":" (Options.string options "document_variants"))
    58         parent base_name
    59         (not (Options.bool options "document_dump_only"), Options.string options "document_dump")
    60         (Options.string options "browser_info_remote")
    61         verbose;
    62     val _ = Session.with_timing name timing (List.app use_theories) theories;
    63     val _ = Session.finish ();
    64     val _ = if save then () else quit ();
    65   in () end
    66   handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);
    67 
    68 end;
    69 
    70 end;