src/Pure/Tools/dump.scala
author wenzelm
Thu, 26 Nov 2020 16:08:39 +0100
changeset 72723 3b804e0ffae9
parent 72691 2126cf946086
child 72724 75cce7926ec1
permissions -rw-r--r--
clarified signature;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Tools/dump.scala
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     3
68348
2ac3a5c07dfa documentation for "isabelle dump";
wenzelm
parents: 68347
diff changeset
     4
Dump cumulative PIDE session database.
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     5
*/
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     6
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     7
package isabelle
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
     8
71534
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
     9
import java.io.{BufferedWriter, FileOutputStream, OutputStreamWriter}
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    10
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
    11
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
    12
object Dump
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
    13
{
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    14
  /* aspects */
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    15
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    16
  sealed case class Aspect_Args(
68355
67a4db47e4f6 more args;
wenzelm
parents: 68348
diff changeset
    17
    options: Options,
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
    18
    deps: Sessions.Deps,
68355
67a4db47e4f6 more args;
wenzelm
parents: 68348
diff changeset
    19
    progress: Progress,
69896
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
    20
    output_dir: Path,
68929
10cbb5d99081 tuned signature;
wenzelm
parents: 68927
diff changeset
    21
    snapshot: Document.Snapshot,
69534
913970ae2324 tuned, according to Isabelle/MMT;
wenzelm
parents: 69533
diff changeset
    22
    status: Document_Status.Node_Status)
68319
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    23
  {
71534
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    24
    def write_path(file_name: Path): Path =
68319
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    25
    {
68929
10cbb5d99081 tuned signature;
wenzelm
parents: 68927
diff changeset
    26
      val path = output_dir + Path.basic(snapshot.node_name.theory) + file_name
72375
e48d93811ed7 clarified signature;
wenzelm
parents: 72235
diff changeset
    27
      Isabelle_System.make_directory(path.dir)
71534
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    28
      path
68319
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    29
    }
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    30
71534
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    31
    def write(file_name: Path, bytes: Bytes): Unit =
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    32
      Bytes.write(write_path(file_name), bytes)
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    33
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    34
    def write(file_name: Path, text: String): Unit =
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    35
      write(file_name, Bytes(text))
68332
7cb681615d0e store Isabelle symbols in canonical form;
wenzelm
parents: 68331
diff changeset
    36
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    37
    def write(file_name: Path, body: XML.Body): Unit =
71534
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    38
      using(File.writer(write_path(file_name).file))(
f10bffaa2bae more scalable output of YXML files;
wenzelm
parents: 71161
diff changeset
    39
        writer => YXML.traversal(s => writer.write(Symbol.encode(s)), body))
68319
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    40
  }
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    41
68347
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    42
  sealed case class Aspect(name: String, description: String, operation: Aspect_Args => Unit,
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    43
    options: List[String] = Nil)
68345
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
    44
  {
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
    45
    override def toString: String = name
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
    46
  }
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    47
69521
wenzelm
parents: 69520
diff changeset
    48
  val known_aspects: List[Aspect] =
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    49
    List(
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    50
      Aspect("markup", "PIDE markup (YXML format)",
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    51
        { case args =>
72691
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    52
            args.write(Path.explode(Export.MARKUP),
72723
3b804e0ffae9 clarified signature;
wenzelm
parents: 72691
diff changeset
    53
              args.snapshot.xml_markup())
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    54
        }),
68319
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    55
      Aspect("messages", "output messages (YXML format)",
2e168460a9c3 more operations;
wenzelm
parents: 68318
diff changeset
    56
        { case args =>
72691
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    57
            args.write(Path.explode(Export.MESSAGES),
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    58
              args.snapshot.messages.iterator.map(_._1).toList)
68347
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    59
        }),
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    60
      Aspect("latex", "generated LaTeX source",
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    61
        { case args =>
72691
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    62
            for {
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    63
              entry <- args.snapshot.exports
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    64
              if entry.name_has_prefix(Export.DOCUMENT_PREFIX)
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    65
            } args.write(Path.explode(entry.name), entry.uncompressed())
72235
a5bf0b69c22a discontinue export_document --- always enabled (reverting f0f83ce0badd);
wenzelm
parents: 72136
diff changeset
    66
        }),
68347
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    67
      Aspect("theory", "foundational theory content",
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    68
        { case args =>
9e6e7ab77434 more dump aspects, with options;
wenzelm
parents: 68345
diff changeset
    69
            for {
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    70
              entry <- args.snapshot.exports
72691
2126cf946086 clarified signature;
wenzelm
parents: 72690
diff changeset
    71
              if entry.name_has_prefix(Export.THEORY_PREFIX)
68365
f9379279f98c clarified signature: prefer Document.Snapshot;
wenzelm
parents: 68355
diff changeset
    72
            } args.write(Path.explode(entry.name), entry.uncompressed())
69533
1d2e6a4e073f clarified options: ensure consolidated Node_Status and thus percentage = 100% for progress;
wenzelm
parents: 69532
diff changeset
    73
        }, options = List("export_theory"))
68345
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
    74
    ).sortBy(_.name)
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    75
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    76
  def show_aspects: String =
68345
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
    77
    cat_lines(known_aspects.map(aspect => aspect.name + " - " + aspect.description))
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    78
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    79
  def the_aspect(name: String): Aspect =
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    80
    known_aspects.find(aspect => aspect.name == name) getOrElse
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    81
      error("Unknown aspect " + quote(name))
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    82
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
    83
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
    84
  /* context and session */
69538
faf547d2834c clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents: 69537
diff changeset
    85
69896
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
    86
  sealed case class Args(
69897
a9849222844d tuned signature;
wenzelm
parents: 69896
diff changeset
    87
    session: Headless.Session,
a9849222844d tuned signature;
wenzelm
parents: 69896
diff changeset
    88
    snapshot: Document.Snapshot,
a9849222844d tuned signature;
wenzelm
parents: 69896
diff changeset
    89
    status: Document_Status.Node_Status)
69896
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
    90
  {
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
    91
    def print_node: String = snapshot.node_name.toString
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
    92
  }
69896
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
    93
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
    94
  object Context
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
    95
  {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
    96
    def apply(
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
    97
      options: Options,
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
    98
      aspects: List[Aspect] = Nil,
71726
a5fda30edae2 clarified signature: more uniform treatment of stopped/interrupted state;
wenzelm
parents: 71678
diff changeset
    99
      progress: Progress = new Progress,
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   100
      dirs: List[Path] = Nil,
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   101
      select_dirs: List[Path] = Nil,
71161
ffccc1f346ae avoid vacuous session Pure -- dump does not read_pure_theory;
wenzelm
parents: 71159
diff changeset
   102
      selection: Sessions.Selection = Sessions.Selection.empty,
71573
c67076c07fb8 avoid accidental update of base session sources (following documentation in "system" manual);
wenzelm
parents: 71534
diff changeset
   103
      pure_base: Boolean = false,
c67076c07fb8 avoid accidental update of base session sources (following documentation in "system" manual);
wenzelm
parents: 71534
diff changeset
   104
      skip_base: Boolean = false): Context =
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   105
    {
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   106
      val session_options: Options =
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   107
      {
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   108
        val options0 = if (NUMA.enabled) NUMA.policy_options(options) else options
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   109
        val options1 =
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   110
          options0 +
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   111
            "parallel_proofs=0" +
71678
wenzelm
parents: 71666
diff changeset
   112
            "completion_limit=0" +
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   113
            "editor_tracing_messages=0" +
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   114
            "editor_presentation"
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   115
        (options1 /: aspects)({ case (opts, aspect) => (opts /: aspect.options)(_ + _) })
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   116
      }
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   117
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   118
      val sessions_structure: Sessions.Structure =
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   119
        Sessions.load_structure(session_options, dirs = dirs, select_dirs = select_dirs).
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   120
          selection(selection)
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   121
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   122
      {
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   123
        val selection_size = sessions_structure.build_graph.size
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   124
        if (selection_size > 1) progress.echo("Loading " + selection_size + " sessions ...")
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   125
      }
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   126
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   127
      val deps: Sessions.Deps =
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   128
        Sessions.deps(sessions_structure, progress = progress).check_errors
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   129
71573
c67076c07fb8 avoid accidental update of base session sources (following documentation in "system" manual);
wenzelm
parents: 71534
diff changeset
   130
      new Context(options, progress, dirs, select_dirs, pure_base, skip_base, session_options, deps)
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   131
    }
69896
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
   132
  }
be7243b97c41 tuned signature;
wenzelm
parents: 69857
diff changeset
   133
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   134
  class Context private(
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   135
    val options: Options,
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   136
    val progress: Progress,
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   137
    val dirs: List[Path],
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   138
    val select_dirs: List[Path],
71161
ffccc1f346ae avoid vacuous session Pure -- dump does not read_pure_theory;
wenzelm
parents: 71159
diff changeset
   139
    val pure_base: Boolean,
71573
c67076c07fb8 avoid accidental update of base session sources (following documentation in "system" manual);
wenzelm
parents: 71534
diff changeset
   140
    val skip_base: Boolean,
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   141
    val session_options: Options,
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   142
    val deps: Sessions.Deps)
69538
faf547d2834c clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents: 69537
diff changeset
   143
  {
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   144
    context =>
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   145
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   146
    def session_dirs: List[Path] = dirs ::: select_dirs
68926
5129fcc1b6c0 dump aspects asynchronously;
wenzelm
parents: 68899
diff changeset
   147
70857
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   148
    def build_logic(logic: String)
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   149
    {
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   150
      Build.build_logic(options, logic, build_heap = true, progress = progress,
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   151
        dirs = session_dirs, strict = true)
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   152
    }
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   153
70864
e94fec16bf50 clarified signature;
wenzelm
parents: 70862
diff changeset
   154
    def sessions(
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   155
      logic: String = default_logic,
70861
cb07f21c9916 simplified options: always split;
wenzelm
parents: 70860
diff changeset
   156
      log: Logger = No_Logger): List[Session] =
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   157
    {
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   158
      /* partitions */
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   159
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   160
      def session_info(session_name: String): Sessions.Info =
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   161
        deps.sessions_structure(session_name)
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   162
70870
877fe56af178 proper build_graph to make session selection work as in "isabelle build";
wenzelm
parents: 70869
diff changeset
   163
      val session_graph = deps.sessions_structure.build_graph
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   164
      val all_sessions = session_graph.topological_order
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   165
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   166
      val afp_sessions =
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   167
        (for (name <- all_sessions if session_info(name).is_afp) yield name).toSet
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   168
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   169
      val afp_bulky_sessions =
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   170
        (for (name <- all_sessions if session_info(name).is_afp_bulky) yield name).toList
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   171
70862
a4ccd277e9c4 clarified treatment of base logic image;
wenzelm
parents: 70861
diff changeset
   172
      val base_sessions =
72065
11dc8929832d clarified order --- proper sorting of requirements;
wenzelm
parents: 71894
diff changeset
   173
        session_graph.all_preds_rev(List(logic).filter(session_graph.defined))
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   174
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   175
      val proof_sessions =
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   176
        session_graph.all_succs(
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   177
          for (name <- all_sessions if session_info(name).record_proofs) yield name)
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   178
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   179
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   180
      /* resulting sessions */
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   181
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   182
      def make_session(
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   183
        selected_sessions: List[String],
71158
1c58a01a372e tuned signature;
wenzelm
parents: 70876
diff changeset
   184
        session_logic: String = logic,
71159
6b03ce9b02c7 clarified vacuous selection vs. Pure;
wenzelm
parents: 71158
diff changeset
   185
        strict: Boolean = false,
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   186
        record_proofs: Boolean = false): List[Session] =
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   187
      {
71159
6b03ce9b02c7 clarified vacuous selection vs. Pure;
wenzelm
parents: 71158
diff changeset
   188
        if (selected_sessions.isEmpty && !strict) Nil
71158
1c58a01a372e tuned signature;
wenzelm
parents: 70876
diff changeset
   189
        else List(new Session(context, session_logic, log, selected_sessions, record_proofs))
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   190
      }
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   191
71161
ffccc1f346ae avoid vacuous session Pure -- dump does not read_pure_theory;
wenzelm
parents: 71159
diff changeset
   192
      val PURE = isabelle.Thy_Header.PURE
ffccc1f346ae avoid vacuous session Pure -- dump does not read_pure_theory;
wenzelm
parents: 71159
diff changeset
   193
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   194
      val base =
71573
c67076c07fb8 avoid accidental update of base session sources (following documentation in "system" manual);
wenzelm
parents: 71534
diff changeset
   195
        if ((logic == PURE && !pure_base) || skip_base) Nil
71161
ffccc1f346ae avoid vacuous session Pure -- dump does not read_pure_theory;
wenzelm
parents: 71159
diff changeset
   196
        else make_session(base_sessions, session_logic = PURE, strict = logic == PURE)
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   197
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   198
      val main =
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   199
        make_session(
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   200
          session_graph.topological_order.filterNot(name =>
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   201
            afp_sessions.contains(name) ||
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   202
            base_sessions.contains(name) ||
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   203
            proof_sessions.contains(name)))
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   204
71161
ffccc1f346ae avoid vacuous session Pure -- dump does not read_pure_theory;
wenzelm
parents: 71159
diff changeset
   205
      val proofs = make_session(proof_sessions, session_logic = PURE, record_proofs = true)
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   206
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   207
      val afp =
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   208
        if (afp_sessions.isEmpty) Nil
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   209
        else {
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   210
          val (part1, part2) =
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   211
          {
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   212
            val graph = session_graph.restrict(afp_sessions -- afp_bulky_sessions)
70862
a4ccd277e9c4 clarified treatment of base logic image;
wenzelm
parents: 70861
diff changeset
   213
            val force_partition1 = AFP.force_partition1.filter(graph.defined)
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   214
            val force_part1 = graph.all_preds(graph.all_succs(force_partition1)).toSet
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   215
            graph.keys.partition(a => force_part1(a) || graph.is_isolated(a))
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   216
          }
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   217
          List(part1, part2, afp_bulky_sessions).flatMap(make_session(_))
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   218
        }
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   219
70874
2010397f7c9a load HOL-Proofs first: it introduces some extra "thm" items that are required later on;
wenzelm
parents: 70871
diff changeset
   220
      proofs ::: base ::: main ::: afp
70857
822f5cbfc5b6 tuned signature;
wenzelm
parents: 70856
diff changeset
   221
    }
70875
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   222
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   223
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   224
    /* processed theories */
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   225
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   226
    private val processed_theories = Synchronized(Set.empty[String])
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   227
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   228
    def process_theory(theory: String): Boolean =
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   229
      processed_theories.change_result(processed => (!processed(theory), processed + theory))
70876
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   230
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   231
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   232
    /* errors */
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   233
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   234
    private val errors = Synchronized(List.empty[String])
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   235
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   236
    def add_errors(more_errs: List[String])
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   237
    {
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   238
      errors.change(errs => errs ::: more_errs)
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   239
    }
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   240
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   241
    def check_errors
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   242
    {
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   243
      val errs = errors.value
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   244
      if (errs.nonEmpty) error(errs.mkString("\n\n"))
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   245
    }
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   246
  }
68926
5129fcc1b6c0 dump aspects asynchronously;
wenzelm
parents: 68899
diff changeset
   247
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   248
  class Session private[Dump](
70867
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   249
    val context: Context,
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   250
    val logic: String,
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   251
    log: Logger,
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   252
    selected_sessions: List[String],
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   253
    record_proofs: Boolean)
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   254
  {
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   255
    /* resources */
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   256
70869
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   257
    val options: Options =
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   258
      if (record_proofs) context.session_options + "record_proofs=2"
1d063b7f7928 incorporate sessions with record_proofs;
wenzelm
parents: 70867
diff changeset
   259
      else context.session_options
70866
209327bd3e3e clarified signature;
wenzelm
parents: 70865
diff changeset
   260
70867
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   261
    private def deps = context.deps
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   262
    private def progress = context.progress
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   263
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   264
    val resources: Headless.Resources =
70865
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   265
      Headless.Resources.make(options, logic, progress = progress, log = log,
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   266
        session_dirs = context.session_dirs,
70867
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   267
        include_sessions = deps.sessions_structure.imports_topological_order)
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   268
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   269
    val used_theories: List[Document.Node.Name] =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   270
    {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   271
      for {
70867
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   272
        session_name <-
70871
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   273
          deps.sessions_structure.build_graph.restrict(selected_sessions.toSet).topological_order
70867
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   274
        (name, theory_options) <- deps(session_name).used_theories
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   275
        if !resources.session_base.loaded_theory(name.theory)
70867
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   276
        if {
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   277
          def warn(msg: String): Unit =
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   278
            progress.echo_warning("Skipping theory " + name + "  (" + msg + ")")
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   279
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   280
          val conditions =
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   281
            space_explode(',', theory_options.string("condition")).
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   282
              filter(cond => Isabelle_System.getenv(cond) == "")
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   283
          if (conditions.nonEmpty) {
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   284
            warn("undefined " + conditions.mkString(", "))
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   285
            false
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   286
          }
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   287
          else if (options.bool("skip_proofs") && !theory_options.bool("skip_proofs")) {
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   288
            warn("option skip_proofs")
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   289
            false
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   290
          }
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   291
          else true
4c8e28dabbc4 clarified signature;
wenzelm
parents: 70866
diff changeset
   292
        }
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   293
      } yield name
68926
5129fcc1b6c0 dump aspects asynchronously;
wenzelm
parents: 68899
diff changeset
   294
    }
5129fcc1b6c0 dump aspects asynchronously;
wenzelm
parents: 68899
diff changeset
   295
5129fcc1b6c0 dump aspects asynchronously;
wenzelm
parents: 68899
diff changeset
   296
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   297
    /* process */
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   298
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   299
    def process(process_theory: Args => Unit, unicode_symbols: Boolean = false)
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   300
    {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   301
      val session = resources.start_session(progress = progress)
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   302
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   303
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   304
      // asynchronous consumer
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   305
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   306
      object Consumer
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   307
      {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   308
        sealed case class Bad_Theory(
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   309
          name: Document.Node.Name,
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   310
          status: Document_Status.Node_Status,
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   311
          errors: List[String])
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   312
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   313
        private val consumer_bad_theories = Synchronized(List.empty[Bad_Theory])
68318
5971199863ea more accurate dependencies;
wenzelm
parents: 68316
diff changeset
   314
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   315
        private val consumer =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   316
          Consumer_Thread.fork(name = "dump")(
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   317
            consume = (args: (Document.Snapshot, Document_Status.Node_Status)) =>
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   318
              {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   319
                val (snapshot, status) = args
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   320
                val name = snapshot.node_name
70871
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   321
                if (status.ok) {
70875
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   322
                  try {
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   323
                    if (context.process_theory(name.theory)) {
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   324
                      process_theory(Args(session, snapshot, status))
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   325
                    }
a62c34770df9 proper guard for process_theory: ensure uniform precedence of results;
wenzelm
parents: 70874
diff changeset
   326
                  }
70871
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   327
                  catch {
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   328
                    case exn: Throwable if !Exn.is_interrupt(exn) =>
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   329
                      val msg = Exn.message(exn)
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   330
                      progress.echo("FAILED to process theory " + name)
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   331
                      progress.echo_error_message(msg)
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   332
                      consumer_bad_theories.change(Bad_Theory(name, status, List(msg)) :: _)
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   333
                  }
70871
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   334
                }
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   335
                else {
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   336
                  val msgs =
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   337
                    for ((tree, pos) <- snapshot.messages if Protocol.is_error(tree))
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   338
                    yield {
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   339
                      "Error" + Position.here(pos) + ":\n" +
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   340
                        XML.content(Pretty.formatted(List(tree)))
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   341
                    }
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   342
                  progress.echo("FAILED to process theory " + name)
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   343
                  msgs.foreach(progress.echo_error_message)
2beac4adc565 more complete coverage of sessions: process_theory operation needs to handle duplicate theories;
wenzelm
parents: 70870
diff changeset
   344
                  consumer_bad_theories.change(Bad_Theory(name, status, msgs) :: _)
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   345
                }
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   346
                true
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   347
              })
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   348
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   349
        def apply(snapshot: Document.Snapshot, status: Document_Status.Node_Status): Unit =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   350
          consumer.send((snapshot, status))
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   351
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   352
        def shutdown(): List[Bad_Theory] =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   353
        {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   354
          consumer.shutdown()
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   355
          consumer_bad_theories.value.reverse
70634
0f8742b5a9e8 more scalable isabelle dump (and derivatives): mark individual theories to share common data in ML;
wenzelm
parents: 70626
diff changeset
   356
        }
0f8742b5a9e8 more scalable isabelle dump (and derivatives): mark individual theories to share common data in ML;
wenzelm
parents: 70626
diff changeset
   357
      }
0f8742b5a9e8 more scalable isabelle dump (and derivatives): mark individual theories to share common data in ML;
wenzelm
parents: 70626
diff changeset
   358
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   359
70653
f7c5b30fc432 load theories in stages, to reduce ML heap requirements;
wenzelm
parents: 70645
diff changeset
   360
      // synchronous body
68320
1d33697199c1 shutdown ML process before output: Theories_Result is timeless/stateless;
wenzelm
parents: 68319
diff changeset
   361
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   362
      try {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   363
        val use_theories_result =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   364
          session.use_theories(used_theories.map(_.theory),
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   365
            unicode_symbols = unicode_symbols,
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   366
            progress = progress,
71601
97ccf48c2f0c misc tuning based on hints by IntelliJ IDEA;
wenzelm
parents: 71573
diff changeset
   367
            commit = Some(Consumer.apply))
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   368
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   369
        val bad_theories = Consumer.shutdown()
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   370
        val bad_msgs =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   371
          bad_theories.map(bad =>
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   372
            Output.clean_yxml(
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   373
              "FAILED theory " + bad.name +
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   374
                (if (bad.status.consolidated) "" else ": " + bad.status.percentage + "% finished") +
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   375
                (if (bad.errors.isEmpty) "" else bad.errors.mkString("\n", "\n", ""))))
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   376
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   377
        val pending_msgs =
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   378
          use_theories_result.nodes_pending match {
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   379
            case Nil => Nil
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   380
            case pending => List("Pending theories: " + commas(pending.map(p => p._1.toString)))
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   381
          }
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   382
70876
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   383
        context.add_errors(bad_msgs ::: pending_msgs)
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   384
      }
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   385
      finally { session.stop() }
69032
90bb4cabe1e8 clarified errors: no result from forced session.stop, check pending theories;
wenzelm
parents: 69026
diff changeset
   386
    }
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   387
  }
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   388
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   389
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   390
  /* dump */
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   391
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   392
  val default_output_dir: Path = Path.explode("dump")
70858
f76126e6a1ab clarified defaults;
wenzelm
parents: 70857
diff changeset
   393
  val default_logic: String = Thy_Header.PURE
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   394
70640
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   395
  def dump(
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   396
    options: Options,
5f4b8a505090 more explicit type Dump.Session, with context information;
wenzelm
parents: 70634
diff changeset
   397
    logic: String,
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   398
    aspects: List[Aspect] = Nil,
71726
a5fda30edae2 clarified signature: more uniform treatment of stopped/interrupted state;
wenzelm
parents: 71678
diff changeset
   399
    progress: Progress = new Progress,
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   400
    log: Logger = No_Logger,
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   401
    dirs: List[Path] = Nil,
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   402
    select_dirs: List[Path] = Nil,
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   403
    output_dir: Path = default_output_dir,
69535
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   404
    selection: Sessions.Selection = Sessions.Selection.empty)
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   405
  {
70856
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   406
    val context =
545229df2f82 clarified signature: static Dump.Context vs. dynamic Dump.Session;
wenzelm
parents: 70796
diff changeset
   407
      Context(options, aspects = aspects, progress = progress, dirs = dirs,
70796
2739631ac368 discontinued pointless dump_checkpoint and share_common_data -- superseded by base logic image in Isabelle/MMT;
wenzelm
parents: 70779
diff changeset
   408
        select_dirs = select_dirs, selection = selection)
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   409
70864
e94fec16bf50 clarified signature;
wenzelm
parents: 70862
diff changeset
   410
    context.build_logic(logic)
e94fec16bf50 clarified signature;
wenzelm
parents: 70862
diff changeset
   411
70865
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   412
    for (session <- context.sessions(logic = logic, log = log)) {
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   413
      session.process((args: Args) =>
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   414
        {
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   415
          progress.echo("Processing theory " + args.print_node + " ...")
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   416
          val aspect_args =
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   417
            Aspect_Args(session.options, context.deps, progress, output_dir,
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   418
              args.snapshot, args.status)
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   419
          aspects.foreach(_.operation(aspect_args))
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   420
        })
4739030a5bf2 clarified signature;
wenzelm
parents: 70864
diff changeset
   421
    }
70876
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   422
91b311e7d040 cumulative errors for session partitions;
wenzelm
parents: 70875
diff changeset
   423
    context.check_errors
69523
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   424
  }
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   425
9403ff523825 tuned signature: for other dump-like tools;
wenzelm
parents: 69522
diff changeset
   426
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   427
  /* Isabelle tool wrapper */
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   428
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   429
  val isabelle_tool =
68348
2ac3a5c07dfa documentation for "isabelle dump";
wenzelm
parents: 68347
diff changeset
   430
    Isabelle_Tool("dump", "dump cumulative PIDE session database", args =>
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   431
    {
68345
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
   432
      var aspects: List[Aspect] = known_aspects
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   433
      var base_sessions: List[String] = Nil
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   434
      var select_dirs: List[Path] = Nil
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
   435
      var output_dir = default_output_dir
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   436
      var requirements = false
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   437
      var exclude_session_groups: List[String] = Nil
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   438
      var all_sessions = false
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   439
      var logic = default_logic
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   440
      var dirs: List[Path] = Nil
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   441
      var session_groups: List[String] = Nil
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   442
      var options = Options.init()
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   443
      var verbose = false
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   444
      var exclude_sessions: List[String] = Nil
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   445
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   446
      val getopts = Getopts("""
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   447
Usage: isabelle dump [OPTIONS] [SESSIONS ...]
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   448
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   449
  Options are:
68345
5bc1e1ac7955 clarified default: all aspects;
wenzelm
parents: 68332
diff changeset
   450
    -A NAMES     dump named aspects (default: """ + known_aspects.mkString("\"", ",", "\"") + """)
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   451
    -B NAME      include session NAME and all descendants
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   452
    -D DIR       include session directory and select its sessions
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
   453
    -O DIR       output directory for dumped files (default: """ + default_output_dir + """)
71807
cdfa8f027bb9 tuned messages;
wenzelm
parents: 71726
diff changeset
   454
    -R           refer to requirements of selected sessions
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   455
    -X NAME      exclude sessions from group NAME and all descendants
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   456
    -a           select all sessions
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   457
    -b NAME      base logic image (default """ + isabelle.quote(default_logic) + """)
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   458
    -d DIR       include session directory
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   459
    -g NAME      select session group NAME
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   460
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   461
    -v           verbose
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   462
    -x NAME      exclude session NAME and all descendants
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   463
68348
2ac3a5c07dfa documentation for "isabelle dump";
wenzelm
parents: 68347
diff changeset
   464
  Dump cumulative PIDE session database, with the following aspects:
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
   465
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
   466
""" + Library.prefix_lines("    ", show_aspects) + "\n",
71601
97ccf48c2f0c misc tuning based on hints by IntelliJ IDEA;
wenzelm
parents: 71573
diff changeset
   467
      "A:" -> (arg => aspects = Library.distinct(space_explode(',', arg)).map(the_aspect)),
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   468
      "B:" -> (arg => base_sessions = base_sessions ::: List(arg)),
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   469
      "D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))),
68316
a1e5de3681f0 more formal dump aspects;
wenzelm
parents: 68308
diff changeset
   470
      "O:" -> (arg => output_dir = Path.explode(arg)),
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   471
      "R" -> (_ => requirements = true),
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   472
      "X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)),
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   473
      "a" -> (_ => all_sessions = true),
70859
6e6254bbce1f split into standard partitions, for improved scalability;
wenzelm
parents: 70858
diff changeset
   474
      "b:" -> (arg => logic = arg),
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   475
      "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
68741
wenzelm
parents: 68557
diff changeset
   476
      "g:" -> (arg => session_groups = session_groups ::: List(arg)),
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   477
      "o:" -> (arg => options = options + arg),
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   478
      "v" -> (_ => verbose = true),
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   479
      "x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg)))
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   480
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   481
      val sessions = getopts(args)
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   482
68951
a7b1fe2d30ad more uniform Progress, with theory() for batch-build and theory_percentage() for PIDE session;
wenzelm
parents: 68948
diff changeset
   483
      val progress = new Console_Progress(verbose = verbose)
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   484
71661
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   485
      val start_date = Date.now()
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   486
71894
wenzelm
parents: 71807
diff changeset
   487
      progress.echo_if(verbose, "Started at " + Build_Log.print_date(start_date))
71661
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   488
69535
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   489
      progress.interrupt_handler {
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   490
        dump(options, logic,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   491
          aspects = aspects,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   492
          progress = progress,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   493
          dirs = dirs,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   494
          select_dirs = select_dirs,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   495
          output_dir = output_dir,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   496
          selection = Sessions.Selection(
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   497
            requirements = requirements,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   498
            all_sessions = all_sessions,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   499
            base_sessions = base_sessions,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   500
            exclude_session_groups = exclude_session_groups,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   501
            exclude_sessions = exclude_sessions,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   502
            session_groups = session_groups,
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   503
            sessions = sessions))
e3a9680d9ed8 clarified errors, according to Isabelle/MMT;
wenzelm
parents: 69534
diff changeset
   504
      }
71661
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   505
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   506
      val end_date = Date.now()
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   507
      val timing = end_date.time - start_date.time
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   508
71894
wenzelm
parents: 71807
diff changeset
   509
      progress.echo_if(verbose, "\nFinished at " + Build_Log.print_date(end_date))
71661
6db526adccac clarified messages: indicate termination explicitly;
wenzelm
parents: 71573
diff changeset
   510
      progress.echo(timing.message_hms + " elapsed time")
68308
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   511
    })
119fc05f6b00 support to dump build database produced by PIDE session;
wenzelm
parents:
diff changeset
   512
}