author | wenzelm |
Wed, 25 Jul 2012 16:41:02 +0200 | |
changeset 48500 | bf7f434b91d7 |
parent 48492 | 03530cf284ca |
child 48511 | 37999ee01156 |
permissions | -rw-r--r-- |
48418 | 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 |
||
48465 | 15 |
local |
16 |
||
48500 | 17 |
fun no_document options = |
18 |
(case Options.string options "document" of "" => true | "false" => true | _ => false) andalso |
|
19 |
(Options.string options "document_dump" = ""); |
|
20 |
||
48465 | 21 |
fun use_thys options = |
48457 | 22 |
Thy_Info.use_thys |
23 |
|> Unsynchronized.setmp Proofterm.proofs (Options.int options "proofs") |
|
24 |
|> Unsynchronized.setmp print_mode |
|
25 |
(space_explode "," (Options.string options "print_mode") @ print_mode_value ()) |
|
26 |
|> Unsynchronized.setmp Goal.parallel_proofs (Options.int options "parallel_proofs") |
|
27 |
|> Unsynchronized.setmp Goal.parallel_proofs_threshold |
|
28 |
(Options.int options "parallel_proofs_threshold") |
|
29 |
|> Unsynchronized.setmp Multithreading.trace (Options.int options "threads_trace") |
|
48460 | 30 |
|> Unsynchronized.setmp Multithreading.max_threads (Options.int options "threads") |
48500 | 31 |
|> no_document options ? Present.no_document |
48486 | 32 |
|> Unsynchronized.setmp quick_and_dirty (Options.bool options "quick_and_dirty") |
33 |
|> Unsynchronized.setmp Printer.show_question_marks_default |
|
34 |
(Options.bool options "show_question_marks") |
|
35 |
|> Unsynchronized.setmp Name_Space.names_long_default (Options.bool options "names_long") |
|
36 |
|> Unsynchronized.setmp Name_Space.names_short_default (Options.bool options "names_short") |
|
48492 | 37 |
|> Unsynchronized.setmp Name_Space.names_unique_default (Options.bool options "names_unique") |
38 |
|> Unsynchronized.setmp Toplevel.timing (Options.bool options "timing"); |
|
48457 | 39 |
|
48465 | 40 |
fun use_theories (options, thys) = |
41 |
let val condition = space_explode "," (Options.string options "condition") in |
|
42 |
(case filter_out (can getenv_strict) condition of |
|
43 |
[] => use_thys options thys |
|
44 |
| conds => |
|
45 |
Output.physical_stderr ("Ignoring theories " ^ commas_quote thys ^ |
|
48477 | 46 |
" (undefined " ^ commas conds ^ ")\n")) |
48465 | 47 |
end; |
48 |
||
49 |
in |
|
50 |
||
48418 | 51 |
fun build args_file = |
52 |
let |
|
48482
45137257399a
pass parent_base_name, which is required for Session.init sanity check;
wenzelm
parents:
48477
diff
changeset
|
53 |
val (save, (options, (timing, (verbose, (browser_info, (parent_base_name, |
48459
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48458
diff
changeset
|
54 |
(name, (base_name, theories)))))))) = |
48418 | 55 |
File.read (Path.explode args_file) |> YXML.parse_body |> |
48457 | 56 |
let open XML.Decode in |
48459
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48458
diff
changeset
|
57 |
pair bool (pair Options.decode (pair bool (pair bool (pair string (pair string |
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48458
diff
changeset
|
58 |
(pair string (pair string ((list (pair Options.decode (list string))))))))))) |
48457 | 59 |
end; |
48418 | 60 |
|
48457 | 61 |
val _ = |
48462
424fd5364f15
clarified "this_name" vs. former "reset" feature -- imitate the latter by loading other session sources directly;
wenzelm
parents:
48461
diff
changeset
|
62 |
Session.init save false |
48457 | 63 |
(Options.bool options "browser_info") browser_info |
48458 | 64 |
(Options.string options "document") |
48457 | 65 |
(Options.bool options "document_graph") |
48466
3b2fb20df17d
further imitation of ISABELLE_USEDIR_OPTIONS via options;
wenzelm
parents:
48465
diff
changeset
|
66 |
(space_explode ":" (Options.string options "document_variants")) |
48482
45137257399a
pass parent_base_name, which is required for Session.init sanity check;
wenzelm
parents:
48477
diff
changeset
|
67 |
parent_base_name base_name |
48468
7f2998b95249
added "document_dump_only" (cf. negated usedir -C);
wenzelm
parents:
48466
diff
changeset
|
68 |
(not (Options.bool options "document_dump_only"), Options.string options "document_dump") |
48463 | 69 |
(Options.string options "browser_info_remote") |
48457 | 70 |
verbose; |
48465 | 71 |
val _ = Session.with_timing name timing (List.app use_theories) theories; |
48418 | 72 |
val _ = Session.finish (); |
48419 | 73 |
val _ = if save then () else quit (); |
48418 | 74 |
in () end |
75 |
handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1); |
|
76 |
||
77 |
end; |
|
48465 | 78 |
|
79 |
end; |