author | wenzelm |
Sat, 29 Dec 2018 17:37:02 +0100 | |
changeset 69538 | faf547d2834c |
parent 69537 | b8e8a724182b |
child 69540 | a1e8bcda8cec |
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, |
69534 | 20 |
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 |
|
69521 | 42 |
val known_aspects: List[Aspect] = |
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()) |
|
69533
1d2e6a4e073f
clarified options: ensure consolidated Node_Status and thus percentage = 100% for progress;
wenzelm
parents:
69532
diff
changeset
|
58 |
}, options = List("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()) |
69533
1d2e6a4e073f
clarified options: ensure consolidated Node_Status and thus percentage = 100% for progress;
wenzelm
parents:
69532
diff
changeset
|
65 |
}, options = List("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 |
||
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
76 |
/* dependencies */ |
68316 | 77 |
|
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
78 |
def used_theories(options: Options, deps: Sessions.Deps, progress: Progress = No_Progress) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
79 |
: List[Document.Node.Name] = |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
80 |
{ |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
81 |
deps.used_theories_condition(options, progress.echo_warning).map(_._2) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
82 |
} |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
83 |
|
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
84 |
def dependencies( |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
85 |
options: Options, |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
86 |
progress: Progress = No_Progress, |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
87 |
dirs: List[Path] = Nil, |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
88 |
select_dirs: List[Path] = Nil, |
69535 | 89 |
selection: Sessions.Selection = Sessions.Selection.empty) |
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
90 |
: (Sessions.Deps, List[Document.Node.Name]) = |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
91 |
{ |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
92 |
val deps = |
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
93 |
Sessions.load_structure(options, dirs = dirs, select_dirs = select_dirs). |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
94 |
selection_deps(options, selection, progress = progress, |
69532 | 95 |
uniform_session = true, loading_sessions = true) |
68318 | 96 |
|
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
97 |
val theories = used_theories(options, deps, progress = progress) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
98 |
|
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
99 |
(deps, theories) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
100 |
} |
68318 | 101 |
|
69535 | 102 |
|
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
103 |
/* session */ |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
104 |
|
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
105 |
def session( |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
106 |
deps: Sessions.Deps, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
107 |
resources: Headless.Resources, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
108 |
process_theory: (Sessions.Deps, Document.Snapshot, Document_Status.Node_Status) => Unit, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
109 |
progress: Progress = No_Progress) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
110 |
{ |
69535 | 111 |
/* asynchronous consumer */ |
68926 | 112 |
|
113 |
object Consumer |
|
114 |
{ |
|
69535 | 115 |
sealed case class Bad_Theory( |
116 |
name: Document.Node.Name, |
|
117 |
status: Document_Status.Node_Status, |
|
118 |
errors: List[String]) |
|
119 |
||
120 |
private val consumer_bad_theories = Synchronized(List.empty[Bad_Theory]) |
|
68926 | 121 |
|
122 |
private val consumer = |
|
123 |
Consumer_Thread.fork(name = "dump")( |
|
124 |
consume = (args: (Document.Snapshot, Document_Status.Node_Status)) => |
|
125 |
{ |
|
69534 | 126 |
val (snapshot, status) = args |
69535 | 127 |
val name = snapshot.node_name |
128 |
if (status.ok) { |
|
129 |
try { process_theory(deps, snapshot, status) } |
|
130 |
catch { |
|
131 |
case exn: Throwable if !Exn.is_interrupt(exn) => |
|
132 |
val msg = Exn.message(exn) |
|
133 |
progress.echo("FAILED to process theory " + name) |
|
134 |
progress.echo_error_message(msg) |
|
135 |
consumer_bad_theories.change(Bad_Theory(name, status, List(msg)) :: _) |
|
136 |
} |
|
137 |
} |
|
68930 | 138 |
else { |
69535 | 139 |
val msgs = |
140 |
for ((tree, pos) <- snapshot.messages if Protocol.is_error(tree)) |
|
141 |
yield { |
|
142 |
"Error" + Position.here(pos) + ":\n" + |
|
143 |
XML.content(Pretty.formatted(List(tree))) |
|
144 |
} |
|
145 |
progress.echo("FAILED to process theory " + name) |
|
146 |
msgs.foreach(progress.echo_error_message) |
|
147 |
consumer_bad_theories.change(Bad_Theory(name, status, msgs) :: _) |
|
68926 | 148 |
} |
149 |
true |
|
150 |
}) |
|
151 |
||
69534 | 152 |
def apply(snapshot: Document.Snapshot, status: Document_Status.Node_Status): Unit = |
153 |
consumer.send((snapshot, status)) |
|
68926 | 154 |
|
69535 | 155 |
def shutdown(): List[Bad_Theory] = |
68926 | 156 |
{ |
157 |
consumer.shutdown() |
|
69535 | 158 |
consumer_bad_theories.value.reverse |
68926 | 159 |
} |
160 |
} |
|
161 |
||
162 |
||
69523 | 163 |
/* run session */ |
68318 | 164 |
|
69536 | 165 |
val session = resources.start_session(progress = progress) |
69535 | 166 |
try { |
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
167 |
val use_theories = used_theories(resources.options, deps).map(_.theory) |
69535 | 168 |
val use_theories_result = |
169 |
session.use_theories(use_theories, progress = progress, commit = Some(Consumer.apply _)) |
|
68320
1d33697199c1
shutdown ML process before output: Theories_Result is timeless/stateless;
wenzelm
parents:
68319
diff
changeset
|
170 |
|
69535 | 171 |
val bad_theories = Consumer.shutdown() |
172 |
val bad_msgs = |
|
173 |
bad_theories.map(bad => |
|
174 |
Output.clean_yxml( |
|
175 |
"FAILED theory " + bad.name + |
|
176 |
(if (bad.status.consolidated) "" else ": " + bad.status.percentage + "% finished") + |
|
177 |
(if (bad.errors.isEmpty) "" else bad.errors.mkString("\n", "\n", "")))) |
|
68320
1d33697199c1
shutdown ML process before output: Theories_Result is timeless/stateless;
wenzelm
parents:
68319
diff
changeset
|
178 |
|
69535 | 179 |
val pending_msgs = |
180 |
use_theories_result.nodes_pending match { |
|
181 |
case Nil => Nil |
|
182 |
case pending => List("Pending theories: " + commas(pending.map(p => p._1.toString))) |
|
183 |
} |
|
184 |
||
185 |
val errors = bad_msgs ::: pending_msgs |
|
186 |
if (errors.nonEmpty) error(errors.mkString("\n\n")) |
|
69032
90bb4cabe1e8
clarified errors: no result from forced session.stop, check pending theories;
wenzelm
parents:
69026
diff
changeset
|
187 |
} |
69535 | 188 |
finally { session.stop() } |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
189 |
} |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
190 |
|
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
191 |
|
69523 | 192 |
/* dump */ |
193 |
||
194 |
val default_output_dir: Path = Path.explode("dump") |
|
195 |
||
196 |
def make_options(options: Options, aspects: List[Aspect] = Nil): Options = |
|
197 |
{ |
|
198 |
val options0 = if (NUMA.enabled) NUMA.policy_options(options) else options |
|
199 |
val options1 = |
|
200 |
options0 + "completion_limit=0" + "ML_statistics=false" + |
|
69533
1d2e6a4e073f
clarified options: ensure consolidated Node_Status and thus percentage = 100% for progress;
wenzelm
parents:
69532
diff
changeset
|
201 |
"parallel_proofs=0" + "editor_tracing_messages=0" + "editor_presentation" |
69523 | 202 |
(options1 /: aspects)({ case (opts, aspect) => (opts /: aspect.options)(_ + _) }) |
203 |
} |
|
204 |
||
205 |
def dump(options: Options, logic: String, |
|
206 |
aspects: List[Aspect] = Nil, |
|
207 |
progress: Progress = No_Progress, |
|
208 |
log: Logger = No_Logger, |
|
209 |
dirs: List[Path] = Nil, |
|
210 |
select_dirs: List[Path] = Nil, |
|
211 |
output_dir: Path = default_output_dir, |
|
212 |
system_mode: Boolean = false, |
|
69535 | 213 |
selection: Sessions.Selection = Sessions.Selection.empty) |
69523 | 214 |
{ |
215 |
if (Build.build_logic(options, logic, build_heap = true, progress = progress, |
|
216 |
dirs = dirs ::: select_dirs, system_mode = system_mode) != 0) error(logic + " FAILED") |
|
217 |
||
218 |
val dump_options = make_options(options, aspects) |
|
219 |
||
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
220 |
val deps = |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
221 |
dependencies(dump_options, progress = progress, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
222 |
dirs = dirs, select_dirs = select_dirs, selection = selection)._1 |
69523 | 223 |
|
69538
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
224 |
val resources = |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
225 |
Headless.Resources.make(dump_options, logic, progress = progress, log = log, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
226 |
session_dirs = dirs ::: select_dirs, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
227 |
include_sessions = deps.sessions_structure.imports_topological_order) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
228 |
|
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
229 |
session(deps, resources, progress = progress, |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
230 |
process_theory = |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
231 |
(deps: Sessions.Deps, snapshot: Document.Snapshot, status: Document_Status.Node_Status) => |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
232 |
{ |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
233 |
val aspect_args = Aspect_Args(dump_options, progress, deps, output_dir, snapshot, status) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
234 |
aspects.foreach(_.operation(aspect_args)) |
faf547d2834c
clarified signature, notably cascade of dump_options, deps, resources, session;
wenzelm
parents:
69537
diff
changeset
|
235 |
}) |
69523 | 236 |
} |
237 |
||
238 |
||
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
239 |
/* Isabelle tool wrapper */ |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
240 |
|
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
241 |
val isabelle_tool = |
68348 | 242 |
Isabelle_Tool("dump", "dump cumulative PIDE session database", args => |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
243 |
{ |
68345 | 244 |
var aspects: List[Aspect] = known_aspects |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
245 |
var base_sessions: List[String] = Nil |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
246 |
var select_dirs: List[Path] = Nil |
68316 | 247 |
var output_dir = default_output_dir |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
248 |
var requirements = false |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
249 |
var exclude_session_groups: List[String] = Nil |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
250 |
var all_sessions = false |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
251 |
var dirs: List[Path] = Nil |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
252 |
var session_groups: List[String] = Nil |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
253 |
var logic = Isabelle_System.getenv("ISABELLE_LOGIC") |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
254 |
var options = Options.init() |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
255 |
var system_mode = false |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
256 |
var verbose = false |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
257 |
var exclude_sessions: List[String] = Nil |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
258 |
|
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
259 |
val getopts = Getopts(""" |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
260 |
Usage: isabelle dump [OPTIONS] [SESSIONS ...] |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
261 |
|
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
262 |
Options are: |
68345 | 263 |
-A NAMES dump named aspects (default: """ + known_aspects.mkString("\"", ",", "\"") + """) |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
264 |
-B NAME include session NAME and all descendants |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
265 |
-D DIR include session directory and select its sessions |
68316 | 266 |
-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
|
267 |
-R operate on requirements of selected sessions |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
268 |
-X NAME exclude sessions from group NAME and all descendants |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
269 |
-a select all sessions |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
270 |
-d DIR include session directory |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
271 |
-g NAME select session group NAME |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
272 |
-l NAME logic session name (default ISABELLE_LOGIC=""" + quote(logic) + """) |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
273 |
-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
|
274 |
-s system build mode for logic image |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
275 |
-v verbose |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
276 |
-x NAME exclude session NAME and all descendants |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
277 |
|
68348 | 278 |
Dump cumulative PIDE session database, with the following aspects: |
68316 | 279 |
|
280 |
""" + Library.prefix_lines(" ", show_aspects) + "\n", |
|
281 |
"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
|
282 |
"B:" -> (arg => base_sessions = base_sessions ::: List(arg)), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
283 |
"D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))), |
68316 | 284 |
"O:" -> (arg => output_dir = Path.explode(arg)), |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
285 |
"R" -> (_ => requirements = true), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
286 |
"X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
287 |
"a" -> (_ => all_sessions = true), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
288 |
"d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))), |
68741 | 289 |
"g:" -> (arg => session_groups = session_groups ::: List(arg)), |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
290 |
"l:" -> (arg => logic = arg), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
291 |
"o:" -> (arg => options = options + arg), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
292 |
"s" -> (_ => system_mode = true), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
293 |
"v" -> (_ => verbose = true), |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
294 |
"x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg))) |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
295 |
|
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
296 |
val sessions = getopts(args) |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
297 |
|
68951
a7b1fe2d30ad
more uniform Progress, with theory() for batch-build and theory_percentage() for PIDE session;
wenzelm
parents:
68948
diff
changeset
|
298 |
val progress = new Console_Progress(verbose = verbose) |
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
299 |
|
69535 | 300 |
progress.interrupt_handler { |
301 |
dump(options, logic, |
|
302 |
aspects = aspects, |
|
303 |
progress = progress, |
|
304 |
dirs = dirs, |
|
305 |
select_dirs = select_dirs, |
|
306 |
output_dir = output_dir, |
|
307 |
selection = Sessions.Selection( |
|
308 |
requirements = requirements, |
|
309 |
all_sessions = all_sessions, |
|
310 |
base_sessions = base_sessions, |
|
311 |
exclude_session_groups = exclude_session_groups, |
|
312 |
exclude_sessions = exclude_sessions, |
|
313 |
session_groups = session_groups, |
|
314 |
sessions = sessions)) |
|
315 |
} |
|
68308
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
316 |
}) |
119fc05f6b00
support to dump build database produced by PIDE session;
wenzelm
parents:
diff
changeset
|
317 |
} |