--- a/src/Pure/Tools/build.scala Wed Apr 01 15:41:08 2015 +0200
+++ b/src/Pure/Tools/build.scala Wed Apr 01 16:24:38 2015 +0200
@@ -162,12 +162,18 @@
def apply(name: String): Session_Info = graph.get_node(name)
def isDefinedAt(name: String): Boolean = graph.defined(name)
- def selection(requirements: Boolean, all_sessions: Boolean,
- session_groups: List[String], sessions: List[String]): (List[String], Session_Tree) =
+ def selection(
+ requirements: Boolean = false,
+ all_sessions: Boolean = false,
+ session_groups: List[String] = Nil,
+ exclude_sessions: List[String] = Nil,
+ sessions: List[String] = Nil): (List[String], Session_Tree) =
{
- val bad_sessions = sessions.filterNot(isDefinedAt(_))
+ val bad_sessions =
+ SortedSet((exclude_sessions ::: sessions).filterNot(isDefinedAt(_)): _*).toList
if (bad_sessions.nonEmpty) error("Undefined session(s): " + commas_quote(bad_sessions))
+ val excluded = graph.all_succs(exclude_sessions).toSet
val pre_selected =
{
if (all_sessions) graph.keys
@@ -179,7 +185,8 @@
if info.select || select(name) || apply(name).groups.exists(select_group)
} yield name).toList
}
- }
+ }.filterNot(excluded)
+
val selected =
if (requirements) (graph.all_preds(pre_selected).toSet -- pre_selected).toList
else pre_selected
@@ -533,7 +540,7 @@
dirs: List[Path],
sessions: List[String]): Deps =
{
- val (_, tree) = find_sessions(options, dirs = dirs).selection(false, false, Nil, sessions)
+ val (_, tree) = find_sessions(options, dirs = dirs).selection(sessions = sessions)
dependencies(inlined_files = inlined_files, tree = tree)
}
@@ -758,13 +765,14 @@
no_build: Boolean = false,
system_mode: Boolean = false,
verbose: Boolean = false,
+ exclude_sessions: List[String] = Nil,
sessions: List[String] = Nil): Map[String, Int] =
{
/* session tree and dependencies */
val full_tree = find_sessions(options.int("completion_limit") = 0, dirs, select_dirs)
val (selected, selected_tree) =
- full_tree.selection(requirements, all_sessions, session_groups, sessions)
+ full_tree.selection(requirements, all_sessions, session_groups, exclude_sessions, sessions)
val deps = dependencies(progress, true, verbose, list_files, check_keywords, selected_tree)
@@ -1010,12 +1018,13 @@
no_build: Boolean = false,
system_mode: Boolean = false,
verbose: Boolean = false,
+ exclude_sessions: List[String] = Nil,
sessions: List[String] = Nil): Int =
{
val results =
- build_results(options, progress, requirements, all_sessions,
- build_heap, clean_build, dirs, select_dirs, session_groups, max_jobs,
- list_files, check_keywords, no_build, system_mode, verbose, sessions)
+ build_results(options, progress, requirements, all_sessions, build_heap, clean_build,
+ dirs, select_dirs, session_groups, max_jobs, list_files, check_keywords,
+ no_build, system_mode, verbose, exclude_sessions, sessions)
val rc = (0 /: results)({ case (rc1, (_, rc2)) => rc1 max rc2 })
if (rc != 0 && (verbose || !no_build)) {
@@ -1043,15 +1052,15 @@
Properties.Value.Boolean(no_build) ::
Properties.Value.Boolean(system_mode) ::
Properties.Value.Boolean(verbose) ::
- Command_Line.Chunks(
- dirs, select_dirs, session_groups, check_keywords, build_options, sessions) =>
+ Command_Line.Chunks(dirs, select_dirs, session_groups, check_keywords,
+ build_options, exclude_sessions, sessions) =>
val options = (Options.init() /: build_options)(_ + _)
val progress = new Console_Progress(verbose)
progress.interrupt_handler {
build(options, progress, requirements, all_sessions, build_heap, clean_build,
dirs.map(Path.explode(_)), select_dirs.map(Path.explode(_)), session_groups,
max_jobs, list_files, check_keywords.toSet, no_build, system_mode,
- verbose, sessions)
+ verbose, exclude_sessions, sessions)
}
case _ => error("Bad arguments:\n" + cat_lines(args))
}