src/Pure/Tools/build.scala
changeset 56372 fadb0fef09d7
parent 56208 06cc31dff138
child 56392 bc118a32a870
equal deleted inserted replaced
56371:fb9ae0727548 56372:fadb0fef09d7
   120               error("Duplicate session " + quote(name) + Position.here(info.pos) +
   120               error("Duplicate session " + quote(name) + Position.here(info.pos) +
   121                 Position.here(graph.get_node(name).pos))
   121                 Position.here(graph.get_node(name).pos))
   122             else graph.new_node(name, info)
   122             else graph.new_node(name, info)
   123         }
   123         }
   124       val graph2 =
   124       val graph2 =
   125         (graph1 /: graph1.entries) {
   125         (graph1 /: graph1.iterator) {
   126           case (graph, (name, (info, _))) =>
   126           case (graph, (name, (info, _))) =>
   127             info.parent match {
   127             info.parent match {
   128               case None => graph
   128               case None => graph
   129               case Some(parent) =>
   129               case Some(parent) =>
   130                 if (!graph.defined(parent))
   130                 if (!graph.defined(parent))
   157       val bad_sessions = sessions.filterNot(isDefinedAt(_))
   157       val bad_sessions = sessions.filterNot(isDefinedAt(_))
   158       if (!bad_sessions.isEmpty) error("Undefined session(s): " + commas_quote(bad_sessions))
   158       if (!bad_sessions.isEmpty) error("Undefined session(s): " + commas_quote(bad_sessions))
   159 
   159 
   160       val pre_selected =
   160       val pre_selected =
   161       {
   161       {
   162         if (all_sessions) graph.keys.toList
   162         if (all_sessions) graph.keys
   163         else {
   163         else {
   164           val select_group = session_groups.toSet
   164           val select_group = session_groups.toSet
   165           val select = sessions.toSet
   165           val select = sessions.toSet
   166           (for {
   166           (for {
   167             (name, (info, _)) <- graph.entries
   167             (name, (info, _)) <- graph.iterator
   168             if info.select || select(name) || apply(name).groups.exists(select_group)
   168             if info.select || select(name) || apply(name).groups.exists(select_group)
   169           } yield name).toList
   169           } yield name).toList
   170         }
   170         }
   171       }
   171       }
   172       val selected =
   172       val selected =
   178     }
   178     }
   179 
   179 
   180     def topological_order: List[(String, Session_Info)] =
   180     def topological_order: List[(String, Session_Info)] =
   181       graph.topological_order.map(name => (name, apply(name)))
   181       graph.topological_order.map(name => (name, apply(name)))
   182 
   182 
   183     override def toString: String = graph.entries.map(_._1).toList.sorted.mkString(",")
   183     override def toString: String = graph.keys_iterator.mkString("Session_Tree(", ", ", ")")
   184   }
   184   }
   185 
   185 
   186 
   186 
   187   /* parser */
   187   /* parser */
   188 
   188 
   321   object Queue
   321   object Queue
   322   {
   322   {
   323     def apply(tree: Session_Tree, load_timings: String => (List[Properties.T], Double)): Queue =
   323     def apply(tree: Session_Tree, load_timings: String => (List[Properties.T], Double)): Queue =
   324     {
   324     {
   325       val graph = tree.graph
   325       val graph = tree.graph
   326       val sessions = graph.keys.toList
   326       val sessions = graph.keys
   327 
   327 
   328       val timings =
   328       val timings =
   329         sessions.par.map((name: String) =>
   329         sessions.par.map((name: String) =>
   330           Exn.capture { (name, load_timings(name)) }).toList.map(Exn.release(_))
   330           Exn.capture { (name, load_timings(name)) }).toList.map(Exn.release(_))
   331       val command_timings =
   331       val command_timings =