140 pos: Position.T = Position.none, |
140 pos: Position.T = Position.none, |
141 doc_names: List[String] = Nil, |
141 doc_names: List[String] = Nil, |
142 session_directories: Map[JFile, String] = Map.empty, |
142 session_directories: Map[JFile, String] = Map.empty, |
143 global_theories: Map[String, String] = Map.empty, |
143 global_theories: Map[String, String] = Map.empty, |
144 loaded_theories: Graph[String, Outer_Syntax] = Graph.string, |
144 loaded_theories: Graph[String, Outer_Syntax] = Graph.string, |
145 used_theories: List[((Document.Node.Name, Options), List[Document.Node.Name])] = Nil, |
145 used_theories: List[(Document.Node.Name, Options)] = Nil, |
146 dump_checkpoints: Set[Document.Node.Name] = Set.empty, |
146 dump_checkpoints: Set[Document.Node.Name] = Set.empty, |
147 known: Known = Known.empty, |
147 known: Known = Known.empty, |
148 overall_syntax: Outer_Syntax = Outer_Syntax.empty, |
148 overall_syntax: Outer_Syntax = Outer_Syntax.empty, |
149 imported_sources: List[(Path, SHA1.Digest)] = Nil, |
149 imported_sources: List[(Path, SHA1.Digest)] = Nil, |
150 sources: List[(Path, SHA1.Digest)] = Nil, |
150 sources: List[(Path, SHA1.Digest)] = Nil, |
198 (_, base) <- session_bases.iterator |
198 (_, base) <- session_bases.iterator |
199 name <- base.dump_checkpoints.iterator |
199 name <- base.dump_checkpoints.iterator |
200 } yield name).toSet |
200 } yield name).toSet |
201 |
201 |
202 def used_theories_condition(default_options: Options, progress: Progress = No_Progress) |
202 def used_theories_condition(default_options: Options, progress: Progress = No_Progress) |
203 : Document.Node.Name.Graph[Options] = |
203 : List[(Document.Node.Name, Options)] = |
204 { |
204 { |
205 val default_skip_proofs = default_options.bool("skip_proofs") |
205 val default_skip_proofs = default_options.bool("skip_proofs") |
206 Document.Node.Name.make_graph( |
206 for { |
207 permissive = true, |
207 session_name <- sessions_structure.build_topological_order |
208 entries = |
208 entry @ (name, options) <- session_bases(session_name).used_theories |
209 for { |
209 if { |
210 session_name <- sessions_structure.build_topological_order |
210 def warn(msg: String): Unit = |
211 entry @ ((name, options), _) <- session_bases(session_name).used_theories |
211 progress.echo_warning("Skipping theory " + name + " (" + msg + ")") |
212 if { |
212 |
213 def warn(msg: String): Unit = |
213 val conditions = |
214 progress.echo_warning("Skipping theory " + name + " (" + msg + ")") |
214 space_explode(',', options.string("condition")). |
215 |
215 filter(cond => Isabelle_System.getenv(cond) == "") |
216 val conditions = |
216 if (conditions.nonEmpty) { |
217 space_explode(',', options.string("condition")). |
217 warn("undefined " + conditions.mkString(", ")) |
218 filter(cond => Isabelle_System.getenv(cond) == "") |
218 false |
219 if (conditions.nonEmpty) { |
219 } |
220 warn("undefined " + conditions.mkString(", ")) |
220 else if (default_skip_proofs && !options.bool("skip_proofs")) { |
221 false |
221 warn("option skip_proofs") |
222 } |
222 false |
223 else if (default_skip_proofs && !options.bool("skip_proofs")) { |
223 } |
224 warn("option skip_proofs") |
224 else true |
225 false |
225 } |
226 } |
226 } yield entry |
227 else true |
|
228 } |
|
229 } yield entry) |
|
230 } |
227 } |
231 |
228 |
232 def sources(name: String): List[SHA1.Digest] = |
229 def sources(name: String): List[SHA1.Digest] = |
233 session_bases(name).sources.map(_._2) |
230 session_bases(name).sources.map(_._2) |
234 |
231 |
364 theories = dependencies.entries, |
361 theories = dependencies.entries, |
365 loaded_files = loaded_files) |
362 loaded_files = loaded_files) |
366 |
363 |
367 val used_theories = |
364 val used_theories = |
368 for ((options, name) <- dependencies.adjunct_theories) |
365 for ((options, name) <- dependencies.adjunct_theories) |
369 yield ((name, options), known.theories(name.theory).header.imports) |
366 yield (name, options) |
370 |
367 |
371 val dir_errors = |
368 val dir_errors = |
372 { |
369 { |
373 val ok = info.dirs.map(_.canonical_file).toSet |
370 val ok = info.dirs.map(_.canonical_file).toSet |
374 val bad = |
371 val bad = |
375 (for { |
372 (for { |
376 ((name, _), _) <- used_theories.iterator |
373 (name, _) <- used_theories.iterator |
377 if imports_base.theory_qualifier(name) == session_name |
374 if imports_base.theory_qualifier(name) == session_name |
378 val path = name.master_dir_path |
375 val path = name.master_dir_path |
379 if !ok(path.canonical_file) |
376 if !ok(path.canonical_file) |
380 path1 = File.relative_path(info.dir.canonical, path).getOrElse(path) |
377 path1 = File.relative_path(info.dir.canonical, path).getOrElse(path) |
381 } yield (path1, name)).toList |
378 } yield (path1, name)).toList |