Make multiTask run all subtasks when none are specified.

git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@847 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
dmharrah 2009-07-07 01:11:46 +00:00
parent 7c6f420b21
commit 0fee43295e
1 changed files with 17 additions and 9 deletions

View File

@ -345,17 +345,25 @@ trait MultiTaskProject extends Project
{
def multiTask(allTests: => List[String])(run: (String => Boolean) => Task) =
task { tests =>
val (exactFilters, testFilters) = tests.toList.map(GlobFilter.apply).partition(_.isInstanceOf[ExactFilter])
val includeTests = exactFilters.map(_.asInstanceOf[ExactFilter].matchName)
val toCheck = scala.collection.mutable.HashSet(includeTests: _*)
toCheck --= allTests
if(!toCheck.isEmpty && log.atLevel(Level.Warn))
def filterInclude =
{
log.warn("Test(s) not found:")
toCheck.foreach(test => log.warn("\t" + test))
val (exactFilters, testFilters) = tests.toList.map(GlobFilter.apply).partition(_.isInstanceOf[ExactFilter])
val includeTests = exactFilters.map(_.asInstanceOf[ExactFilter].matchName)
val toCheck = scala.collection.mutable.HashSet(includeTests: _*)
toCheck --= allTests
if(!toCheck.isEmpty && log.atLevel(Level.Warn))
{
log.warn("Test(s) not found:")
toCheck.foreach(test => log.warn("\t" + test))
}
val includeTestsSet = Set(includeTests: _*)
(test: String) => includeTestsSet.contains(test) || testFilters.exists(_.accept(test))
}
val includeTestsSet = Set(includeTests: _*)
val includeFunction = (test: String) => includeTestsSet.contains(test) || testFilters.exists(_.accept(test))
val includeFunction =
if(tests.isEmpty)
(test: String) => true
else
filterInclude
run(includeFunction)
} completeWith allTests