more robust build_hierarchy: support Resources.empty / Sessions.Structure.empty (required for Build_Job.print_log);
authorwenzelm
Fri, 05 Aug 2022 13:23:52 +0200
changeset 75760 f8be63d2ec6f
parent 75759 0cdccd0d1699
child 75761 2a0051496844
more robust build_hierarchy: support Resources.empty / Sessions.Structure.empty (required for Build_Job.print_log); removed unused imports_hierarchy;
src/Pure/Thy/sessions.scala
--- a/src/Pure/Thy/sessions.scala	Thu Aug 04 22:15:50 2022 +0200
+++ b/src/Pure/Thy/sessions.scala	Fri Aug 05 13:23:52 2022 +0200
@@ -830,17 +830,19 @@
       deps
     }
 
+    def build_hierarchy(session: String): List[String] =
+      if (build_graph.defined(session)) build_graph.all_preds(List(session))
+      else List(session)
+
     def build_selection(sel: Selection): List[String] = selected(build_graph, sel)
     def build_descendants(ss: List[String]): List[String] = build_graph.all_succs(ss)
     def build_requirements(ss: List[String]): List[String] = build_graph.all_preds_rev(ss)
     def build_topological_order: List[String] = build_graph.topological_order
-    def build_hierarchy(session: String): List[String] = build_graph.all_preds(List(session))
 
     def imports_selection(sel: Selection): List[String] = selected(imports_graph, sel)
     def imports_descendants(ss: List[String]): List[String] = imports_graph.all_succs(ss)
     def imports_requirements(ss: List[String]): List[String] = imports_graph.all_preds_rev(ss)
     def imports_topological_order: List[String] = imports_graph.topological_order
-    def imports_hierarchy(session: String): List[String] = imports_graph.all_preds(List(session))
 
     def bibtex_entries: List[(String, List[String])] =
       build_topological_order.flatMap(name =>