src/Pure/System/build.ML
author wenzelm
Tue, 24 Jul 2012 10:11:49 +0200
changeset 48458 09710d6fc3d1
parent 48457 fd9e28d5a143
child 48459 375e45df6fdf
permissions -rw-r--r--
clarified document options;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48418
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/System/build.ML
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     3
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     4
Build Isabelle sessions.
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     5
*)
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     6
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     7
signature BUILD =
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     8
sig
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
     9
  val build: string -> unit
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    10
end;
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    11
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    12
structure Build: BUILD =
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    13
struct
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    14
48457
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    15
fun use_theories name options =
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    16
  Thy_Info.use_thys
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    17
    |> Session.with_timing name (Options.bool options "timing")
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    18
    |> Unsynchronized.setmp Proofterm.proofs (Options.int options "proofs")
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    19
    |> Unsynchronized.setmp print_mode
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    20
        (space_explode "," (Options.string options "print_mode") @ print_mode_value ())
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    21
    |> Unsynchronized.setmp Goal.parallel_proofs (Options.int options "parallel_proofs")
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    22
    |> Unsynchronized.setmp Goal.parallel_proofs_threshold
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    23
        (Options.int options "parallel_proofs_threshold")
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    24
    |> Unsynchronized.setmp Multithreading.trace (Options.int options "threads_trace")
48458
09710d6fc3d1 clarified document options;
wenzelm
parents: 48457
diff changeset
    25
    |> Unsynchronized.setmp Multithreading.max_threads (Options.int options "threads_limit")
09710d6fc3d1 clarified document options;
wenzelm
parents: 48457
diff changeset
    26
    |> Options.bool options "no_document" ? Present.no_document;
48457
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    27
48418
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    28
fun build args_file =
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    29
  let
48457
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    30
    val (save, (options, (verbose, (browser_info, (parent, (name, (base_name, theories))))))) =
48418
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    31
      File.read (Path.explode args_file) |> YXML.parse_body |>
48457
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    32
        let open XML.Decode in
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    33
          pair bool (pair Options.decode (pair bool (pair string (pair string
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    34
            (pair string (pair string ((list (pair Options.decode (list string))))))))))
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    35
        end;
48418
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    36
48457
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    37
    val _ =
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    38
      Session.init
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    39
        save
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    40
        false (* FIXME reset!? *)
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    41
        (Options.bool options "browser_info") browser_info
48458
09710d6fc3d1 clarified document options;
wenzelm
parents: 48457
diff changeset
    42
        (Options.string options "document")
48457
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    43
        (Options.bool options "document_graph")
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    44
        (space_explode "," (Options.string options "document_variants"))
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    45
        parent
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    46
        base_name
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    47
        (true (* FIXME copy document/ files on Scala side!? *),
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    48
          Options.string options "document_dump")
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    49
        ""
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    50
        verbose;
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    51
fd9e28d5a143 pass build options to ML;
wenzelm
parents: 48419
diff changeset
    52
    val _ = List.app (uncurry (use_theories name)) theories;
48418
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    53
    val _ = Session.finish ();
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    54
48419
6d7b6e47f3ef save image for inner nodes only;
wenzelm
parents: 48418
diff changeset
    55
    val _ = if save then () else quit ();
48418
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    56
  in () end
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    57
  handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    58
1a634f9614fb some actual build function on ML side;
wenzelm
parents:
diff changeset
    59
end;