src/Pure/System/build.ML
author wenzelm
Tue, 24 Jul 2012 21:54:49 +0200
changeset 49507 03530cf284ca
parent 49501 691d0b44a793
child 49515 bf7f434b91d7
permissions -rw-r--r--
more build options;
     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     |> Unsynchronized.setmp Printer.show_question_marks_default
    31         (Options.bool options "show_question_marks")
    32     |> Unsynchronized.setmp Name_Space.names_long_default (Options.bool options "names_long")
    33     |> Unsynchronized.setmp Name_Space.names_short_default (Options.bool options "names_short")
    34     |> Unsynchronized.setmp Name_Space.names_unique_default (Options.bool options "names_unique")
    35     |> Unsynchronized.setmp Toplevel.timing (Options.bool options "timing");
    36 
    37 fun use_theories (options, thys) =
    38   let val condition = space_explode "," (Options.string options "condition") in
    39     (case filter_out (can getenv_strict) condition of
    40       [] => use_thys options thys
    41     | conds =>
    42         Output.physical_stderr ("Ignoring theories " ^ commas_quote thys ^
    43           " (undefined " ^ commas conds ^ ")\n"))
    44   end;
    45 
    46 in
    47 
    48 fun build args_file =
    49   let
    50     val (save, (options, (timing, (verbose, (browser_info, (parent_base_name,
    51         (name, (base_name, theories)))))))) =
    52       File.read (Path.explode args_file) |> YXML.parse_body |>
    53         let open XML.Decode in
    54           pair bool (pair Options.decode (pair bool (pair bool (pair string (pair string
    55             (pair string (pair string ((list (pair Options.decode (list string)))))))))))
    56         end;
    57 
    58     val _ =
    59       Session.init save false
    60         (Options.bool options "browser_info") browser_info
    61         (Options.string options "document")
    62         (Options.bool options "document_graph")
    63         (space_explode ":" (Options.string options "document_variants"))
    64         parent_base_name base_name
    65         (not (Options.bool options "document_dump_only"), Options.string options "document_dump")
    66         (Options.string options "browser_info_remote")
    67         verbose;
    68     val _ = Session.with_timing name timing (List.app use_theories) theories;
    69     val _ = Session.finish ();
    70     val _ = if save then () else quit ();
    71   in () end
    72   handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);
    73 
    74 end;
    75 
    76 end;