| author | immler | 
| Thu, 27 Dec 2018 21:00:50 +0100 | |
| changeset 69510 | 0f31dd2e540d | 
| parent 69103 | 814a1ab42d70 | 
| child 69520 | 16779868de1f | 
| permissions | -rw-r--r-- | 
| 
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 | 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  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
9  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
10  | 
object Dump  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
11  | 
{
 | 
| 68316 | 12  | 
/* aspects */  | 
13  | 
||
14  | 
sealed case class Aspect_Args(  | 
|
| 68355 | 15  | 
options: Options,  | 
16  | 
progress: Progress,  | 
|
| 68365 | 17  | 
deps: Sessions.Deps,  | 
| 68355 | 18  | 
output_dir: Path,  | 
| 68929 | 19  | 
snapshot: Document.Snapshot,  | 
20  | 
node_status: Document_Status.Node_Status)  | 
|
| 68319 | 21  | 
  {
 | 
| 68365 | 22  | 
def write(file_name: Path, bytes: Bytes)  | 
| 68319 | 23  | 
    {
 | 
| 68929 | 24  | 
val path = output_dir + Path.basic(snapshot.node_name.theory) + file_name  | 
| 68319 | 25  | 
Isabelle_System.mkdirs(path.dir)  | 
26  | 
Bytes.write(path, bytes)  | 
|
27  | 
}  | 
|
28  | 
||
| 68365 | 29  | 
def write(file_name: Path, text: String): Unit =  | 
30  | 
write(file_name, Bytes(text))  | 
|
| 68332 | 31  | 
|
| 68365 | 32  | 
def write(file_name: Path, body: XML.Body): Unit =  | 
33  | 
write(file_name, Symbol.encode(YXML.string_of_body(body)))  | 
|
| 68319 | 34  | 
}  | 
| 68316 | 35  | 
|
| 68347 | 36  | 
sealed case class Aspect(name: String, description: String, operation: Aspect_Args => Unit,  | 
37  | 
options: List[String] = Nil)  | 
|
| 68345 | 38  | 
  {
 | 
39  | 
override def toString: String = name  | 
|
40  | 
}  | 
|
| 68316 | 41  | 
|
| 68347 | 42  | 
val known_aspects =  | 
| 68316 | 43  | 
List(  | 
| 68365 | 44  | 
      Aspect("markup", "PIDE markup (YXML format)",
 | 
45  | 
        { case args =>
 | 
|
46  | 
            args.write(Path.explode("markup.yxml"),
 | 
|
47  | 
args.snapshot.markup_to_XML(Text.Range.full, Markup.Elements.full))  | 
|
48  | 
}),  | 
|
| 68319 | 49  | 
      Aspect("messages", "output messages (YXML format)",
 | 
50  | 
        { case args =>
 | 
|
| 68365 | 51  | 
            args.write(Path.explode("messages.yxml"),
 | 
52  | 
args.snapshot.messages.iterator.map(_._1).toList)  | 
|
| 68347 | 53  | 
}),  | 
54  | 
      Aspect("latex", "generated LaTeX source",
 | 
|
55  | 
        { case args =>
 | 
|
| 68365 | 56  | 
for (entry <- args.snapshot.exports if entry.name == "document.tex")  | 
57  | 
args.write(Path.explode(entry.name), entry.uncompressed())  | 
|
| 
68491
 
f0f83ce0badd
disable export_document by default (presently unused and for demo/testing purposes): avoid spurious IO exception in highly parallel environment;
 
wenzelm 
parents: 
68416 
diff
changeset
 | 
58  | 
        }, options = List("editor_presentation", "export_document")),
 | 
| 68347 | 59  | 
      Aspect("theory", "foundational theory content",
 | 
60  | 
        { case args =>
 | 
|
61  | 
            for {
 | 
|
| 68365 | 62  | 
entry <- args.snapshot.exports  | 
| 68347 | 63  | 
if entry.name.startsWith(Export_Theory.export_prefix)  | 
| 68365 | 64  | 
} args.write(Path.explode(entry.name), entry.uncompressed())  | 
| 68347 | 65  | 
        }, options = List("editor_presentation", "export_theory"))
 | 
| 68345 | 66  | 
).sortBy(_.name)  | 
| 68316 | 67  | 
|
68  | 
def show_aspects: String =  | 
|
| 68345 | 69  | 
cat_lines(known_aspects.map(aspect => aspect.name + " - " + aspect.description))  | 
| 68316 | 70  | 
|
71  | 
def the_aspect(name: String): Aspect =  | 
|
72  | 
known_aspects.find(aspect => aspect.name == name) getOrElse  | 
|
73  | 
      error("Unknown aspect " + quote(name))
 | 
|
74  | 
||
75  | 
||
76  | 
/* dump */  | 
|
77  | 
||
| 68945 | 78  | 
  val default_output_dir: Path = Path.explode("dump")
 | 
| 68316 | 79  | 
|
| 68416 | 80  | 
def make_options(options: Options, aspects: List[Aspect]): Options =  | 
| 68895 | 81  | 
  {
 | 
| 
68954
 
8be4030394b8
implicit use of NUMA policy, absorbing potential errors;
 
wenzelm 
parents: 
68951 
diff
changeset
 | 
82  | 
val options0 = if (NUMA.enabled) NUMA.policy_options(options) else options  | 
| 
69103
 
814a1ab42d70
unbounded tracing for proper termination, e.g. relevant for theory Sequents.Hard_Quantifiers;
 
wenzelm 
parents: 
69033 
diff
changeset
 | 
83  | 
val options1 =  | 
| 
 
814a1ab42d70
unbounded tracing for proper termination, e.g. relevant for theory Sequents.Hard_Quantifiers;
 
wenzelm 
parents: 
69033 
diff
changeset
 | 
84  | 
options0 + "completion_limit=0" + "ML_statistics=false" +  | 
| 
 
814a1ab42d70
unbounded tracing for proper termination, e.g. relevant for theory Sequents.Hard_Quantifiers;
 
wenzelm 
parents: 
69033 
diff
changeset
 | 
85  | 
"parallel_proofs=0" + "editor_tracing_messages=0"  | 
| 68895 | 86  | 
    (options1 /: aspects)({ case (opts, aspect) => (opts /: aspect.options)(_ + _) })
 | 
87  | 
}  | 
|
| 68416 | 88  | 
|
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
89  | 
def dump(options: Options, logic: String,  | 
| 68316 | 90  | 
aspects: List[Aspect] = Nil,  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
91  | 
progress: Progress = No_Progress,  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
92  | 
log: Logger = No_Logger,  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
93  | 
dirs: List[Path] = Nil,  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
94  | 
select_dirs: List[Path] = Nil,  | 
| 68316 | 95  | 
output_dir: Path = default_output_dir,  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
96  | 
verbose: Boolean = false,  | 
| 69012 | 97  | 
commit_cleanup_delay: Time = Headless.default_commit_cleanup_delay,  | 
98  | 
watchdog_timeout: Time = Headless.default_watchdog_timeout,  | 
|
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
99  | 
system_mode: Boolean = false,  | 
| 
69032
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
100  | 
selection: Sessions.Selection = Sessions.Selection.empty): Boolean =  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
101  | 
  {
 | 
| 68537 | 102  | 
if (Build.build_logic(options, logic, build_heap = true, progress = progress,  | 
| 68743 | 103  | 
dirs = dirs ::: select_dirs, system_mode = system_mode) != 0) error(logic + " FAILED")  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
104  | 
|
| 68416 | 105  | 
val dump_options = make_options(options, aspects)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
106  | 
|
| 68318 | 107  | 
|
108  | 
/* dependencies */  | 
|
109  | 
||
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
110  | 
val deps =  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
111  | 
Sessions.load_structure(dump_options, dirs = dirs, select_dirs = select_dirs).  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
112  | 
selection_deps(selection)  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
113  | 
|
| 68318 | 114  | 
val include_sessions =  | 
115  | 
deps.sessions_structure.imports_topological_order  | 
|
116  | 
||
| 69025 | 117  | 
val use_theories =  | 
| 
69026
 
6e2f9f62aafd
suppress some theories to allow "isabelle dump -o skip_proofs";
 
wenzelm 
parents: 
69025 
diff
changeset
 | 
118  | 
      for { (_, name) <- deps.used_theories_condition(dump_options, progress.echo_warning) }
 | 
| 69025 | 119  | 
yield name.theory  | 
| 68318 | 120  | 
|
121  | 
||
| 68926 | 122  | 
/* dump aspects asynchronously */  | 
123  | 
||
124  | 
object Consumer  | 
|
125  | 
    {
 | 
|
| 68930 | 126  | 
private val consumer_ok = Synchronized(true)  | 
| 68926 | 127  | 
|
128  | 
private val consumer =  | 
|
129  | 
Consumer_Thread.fork(name = "dump")(  | 
|
130  | 
consume = (args: (Document.Snapshot, Document_Status.Node_Status)) =>  | 
|
131  | 
            {
 | 
|
132  | 
val (snapshot, node_status) = args  | 
|
133  | 
              if (node_status.ok) {
 | 
|
134  | 
val aspect_args =  | 
|
| 68929 | 135  | 
Aspect_Args(dump_options, progress, deps, output_dir, snapshot, node_status)  | 
| 68926 | 136  | 
aspects.foreach(_.operation(aspect_args))  | 
137  | 
}  | 
|
| 68930 | 138  | 
              else {
 | 
139  | 
consumer_ok.change(_ => false)  | 
|
140  | 
                for ((tree, pos) <- snapshot.messages if Protocol.is_error(tree)) {
 | 
|
141  | 
val msg = XML.content(Pretty.formatted(List(tree)))  | 
|
142  | 
                  progress.echo_error_message("Error" + Position.here(pos) + ":\n" + msg)
 | 
|
143  | 
}  | 
|
| 68926 | 144  | 
}  | 
145  | 
true  | 
|
146  | 
})  | 
|
147  | 
||
148  | 
def apply(snapshot: Document.Snapshot, node_status: Document_Status.Node_Status): Unit =  | 
|
149  | 
consumer.send((snapshot, node_status))  | 
|
150  | 
||
| 68930 | 151  | 
def shutdown(): Boolean =  | 
| 68926 | 152  | 
      {
 | 
153  | 
consumer.shutdown()  | 
|
| 68930 | 154  | 
consumer_ok.value  | 
| 68926 | 155  | 
}  | 
156  | 
}  | 
|
157  | 
||
158  | 
||
| 68318 | 159  | 
/* session */  | 
160  | 
||
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
161  | 
val session =  | 
| 69012 | 162  | 
Headless.start_session(dump_options, logic, session_dirs = dirs ::: select_dirs,  | 
| 68318 | 163  | 
include_sessions = include_sessions, progress = progress, log = log)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
164  | 
|
| 69013 | 165  | 
val use_theories_result =  | 
| 
68936
 
90c08c7bab9c
continuously clean frontier of already committed theories: much less resource requirements;
 
wenzelm 
parents: 
68930 
diff
changeset
 | 
166  | 
session.use_theories(use_theories,  | 
| 
 
90c08c7bab9c
continuously clean frontier of already committed theories: much less resource requirements;
 
wenzelm 
parents: 
68930 
diff
changeset
 | 
167  | 
progress = progress,  | 
| 
 
90c08c7bab9c
continuously clean frontier of already committed theories: much less resource requirements;
 
wenzelm 
parents: 
68930 
diff
changeset
 | 
168  | 
commit = Some(Consumer.apply _),  | 
| 68981 | 169  | 
commit_cleanup_delay = commit_cleanup_delay,  | 
| 68945 | 170  | 
watchdog_timeout = watchdog_timeout)  | 
| 68926 | 171  | 
|
| 
69032
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
172  | 
session.stop()  | 
| 
68320
 
1d33697199c1
shutdown ML process before output: Theories_Result is timeless/stateless;
 
wenzelm 
parents: 
68319 
diff
changeset
 | 
173  | 
|
| 68930 | 174  | 
val consumer_ok = Consumer.shutdown()  | 
| 
68320
 
1d33697199c1
shutdown ML process before output: Theories_Result is timeless/stateless;
 
wenzelm 
parents: 
68319 
diff
changeset
 | 
175  | 
|
| 
69032
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
176  | 
    use_theories_result.nodes_pending match {
 | 
| 
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
177  | 
case Nil =>  | 
| 
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
178  | 
      case pending => error("Pending theories " + commas_quote(pending.map(p => p._1.toString)))
 | 
| 
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
179  | 
}  | 
| 
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
180  | 
|
| 
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
181  | 
use_theories_result.ok && consumer_ok  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
182  | 
}  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
183  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
184  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
185  | 
/* Isabelle tool wrapper */  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
186  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
187  | 
val isabelle_tool =  | 
| 68348 | 188  | 
    Isabelle_Tool("dump", "dump cumulative PIDE session database", args =>
 | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
189  | 
    {
 | 
| 68345 | 190  | 
var aspects: List[Aspect] = known_aspects  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
191  | 
var base_sessions: List[String] = Nil  | 
| 69012 | 192  | 
var commit_cleanup_delay = Headless.default_commit_cleanup_delay  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
193  | 
var select_dirs: List[Path] = Nil  | 
| 68316 | 194  | 
var output_dir = default_output_dir  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
195  | 
var requirements = false  | 
| 69012 | 196  | 
var watchdog_timeout = Headless.default_watchdog_timeout  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
197  | 
var exclude_session_groups: List[String] = Nil  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
198  | 
var all_sessions = false  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
199  | 
var dirs: List[Path] = Nil  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
200  | 
var session_groups: List[String] = Nil  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
201  | 
      var logic = Isabelle_System.getenv("ISABELLE_LOGIC")
 | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
202  | 
var options = Options.init()  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
203  | 
var system_mode = false  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
204  | 
var verbose = false  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
205  | 
var exclude_sessions: List[String] = Nil  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
206  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
207  | 
      val getopts = Getopts("""
 | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
208  | 
Usage: isabelle dump [OPTIONS] [SESSIONS ...]  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
209  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
210  | 
Options are:  | 
| 68345 | 211  | 
    -A NAMES     dump named aspects (default: """ + known_aspects.mkString("\"", ",", "\"") + """)
 | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
212  | 
-B NAME include session NAME and all descendants  | 
| 68947 | 213  | 
-C SECONDS delay for cleaning of already dumped theories (0 = disabled, default: """ +  | 
| 69012 | 214  | 
Value.Seconds(Headless.default_commit_cleanup_delay) + """)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
215  | 
-D DIR include session directory and select its sessions  | 
| 68316 | 216  | 
-O DIR output directory for dumped files (default: """ + default_output_dir + """)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
217  | 
-R operate on requirements of selected sessions  | 
| 68948 | 218  | 
-W SECONDS watchdog timeout for PIDE processing (0 = disabled, default: """ +  | 
| 69012 | 219  | 
Value.Seconds(Headless.default_watchdog_timeout) + """)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
220  | 
-X NAME exclude sessions from group NAME and all descendants  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
221  | 
-a select all sessions  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
222  | 
-d DIR include session directory  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
223  | 
-g NAME select session group NAME  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
224  | 
-l NAME logic session name (default ISABELLE_LOGIC=""" + quote(logic) + """)  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
225  | 
-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
 | 
226  | 
-s system build mode for logic image  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
227  | 
-v verbose  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
228  | 
-x NAME exclude session NAME and all descendants  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
229  | 
|
| 68348 | 230  | 
Dump cumulative PIDE session database, with the following aspects:  | 
| 68316 | 231  | 
|
232  | 
""" + Library.prefix_lines("    ", show_aspects) + "\n",
 | 
|
233  | 
      "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
 | 
234  | 
"B:" -> (arg => base_sessions = base_sessions ::: List(arg)),  | 
| 68981 | 235  | 
"C:" -> (arg => commit_cleanup_delay = Value.Seconds.parse(arg)),  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
236  | 
"D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))),  | 
| 68316 | 237  | 
"O:" -> (arg => output_dir = Path.explode(arg)),  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
238  | 
"R" -> (_ => requirements = true),  | 
| 68945 | 239  | 
"W:" -> (arg => watchdog_timeout = Value.Seconds.parse(arg)),  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
240  | 
"X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)),  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
241  | 
"a" -> (_ => all_sessions = true),  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
242  | 
"d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),  | 
| 68741 | 243  | 
"g:" -> (arg => session_groups = session_groups ::: List(arg)),  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
244  | 
"l:" -> (arg => logic = arg),  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
245  | 
"o:" -> (arg => options = options + arg),  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
246  | 
"s" -> (_ => system_mode = true),  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
247  | 
"v" -> (_ => verbose = true),  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
248  | 
"x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg)))  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
249  | 
|
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
250  | 
val sessions = getopts(args)  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
251  | 
|
| 
68951
 
a7b1fe2d30ad
more uniform Progress, with theory() for batch-build and theory_percentage() for PIDE session;
 
wenzelm 
parents: 
68948 
diff
changeset
 | 
252  | 
val progress = new Console_Progress(verbose = verbose)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
253  | 
|
| 
69032
 
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
 
wenzelm 
parents: 
69026 
diff
changeset
 | 
254  | 
val ok =  | 
| 68331 | 255  | 
        progress.interrupt_handler {
 | 
256  | 
dump(options, logic,  | 
|
257  | 
aspects = aspects,  | 
|
258  | 
progress = progress,  | 
|
259  | 
dirs = dirs,  | 
|
260  | 
select_dirs = select_dirs,  | 
|
261  | 
output_dir = output_dir,  | 
|
| 68981 | 262  | 
commit_cleanup_delay = commit_cleanup_delay,  | 
| 68945 | 263  | 
watchdog_timeout = watchdog_timeout,  | 
| 68331 | 264  | 
verbose = verbose,  | 
265  | 
selection = Sessions.Selection(  | 
|
266  | 
requirements = requirements,  | 
|
267  | 
all_sessions = all_sessions,  | 
|
268  | 
base_sessions = base_sessions,  | 
|
269  | 
exclude_session_groups = exclude_session_groups,  | 
|
270  | 
exclude_sessions = exclude_sessions,  | 
|
271  | 
session_groups = session_groups,  | 
|
272  | 
sessions = sessions))  | 
|
273  | 
}  | 
|
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
274  | 
|
| 69033 | 275  | 
if (!ok) sys.exit(2)  | 
| 
68308
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
276  | 
})  | 
| 
 
119fc05f6b00
support to dump build database produced by PIDE session;
 
wenzelm 
parents:  
diff
changeset
 | 
277  | 
}  |