Defer checking test names until they are needed (after test-compile). Not as immediate feedback, but it is more accurate.

This commit is contained in:
Mark Harrah 2010-04-24 22:48:57 -04:00
parent 5ee7575206
commit fdd0e14e71
3 changed files with 20 additions and 12 deletions

View File

@ -299,7 +299,7 @@ abstract class BasicScalaProject extends ScalaProject with BasicDependencyProjec
protected def packageProjectAction = zipTask(packageProjectPaths, packageProjectZip) describedAs ProjectPackageDescription
protected def docAllAction = (doc && docTest) describedAs DocAllDescription
protected def packageAllAction = task { None } dependsOn(`package`, packageTest, packageSrc, packageTestSrc, packageDocs) describedAs PackageAllDescription
protected def packageAllAction = Empty dependsOn(`package`, packageTest, packageSrc, packageTestSrc, packageDocs) describedAs PackageAllDescription
protected def graphSourcesAction = graphSourcesTask(graphSourcesPath, mainSourceRoots, mainCompileConditional.analysis).dependsOn(compile)
protected def graphPackagesAction = graphPackagesTask(graphPackagesPath, mainSourceRoots, mainCompileConditional.analysis).dependsOn(compile)
protected def incrementVersionAction = task { incrementVersionNumber(); None } describedAs IncrementVersionDescription

View File

@ -173,8 +173,8 @@ trait ScalaProject extends SimpleScalaProject with FileTasks with MultiTaskProje
val beginTasks = begin.map(toTask).toSeq // test setup tasks
val workTasks = work.map(w => toTask(w) dependsOn(beginTasks : _*)) // the actual tests
val endTasks = end.map(toTask).toSeq // tasks that perform test cleanup and are run regardless of success of tests
val endTask = task { None } named("test-cleanup") dependsOn(endTasks : _*)
val rootTask = task { None } named("test-complete") dependsOn(workTasks.toSeq : _*) // the task that depends on all test subtasks
val endTask = Empty named("test-cleanup") dependsOn(endTasks : _*)
val rootTask = Empty named("test-complete") dependsOn(workTasks.toSeq : _*) // the task that depends on all test subtasks
SubWork[Project#Task](rootTask, endTask)
}
new CompoundTask(work)
@ -392,17 +392,24 @@ trait MultiTaskProject extends Project
def filterInclude =
{
val (exactFilters, testFilters) = testNames.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))
lazy val (exactFilters, testFilters) = testNames.toList.map(GlobFilter.apply).partition(_.isInstanceOf[ExactFilter])
lazy val includeTests = exactFilters.map(_.asInstanceOf[ExactFilter].matchName)
def checkExistence() =
{
log.warn("Test(s) not found:")
toCheck.foreach(test => log.warn("\t" + test))
val toCheck = Set() ++ includeTests -- allTests
if(!toCheck.isEmpty && log.atLevel(Level.Warn))
{
log.warn("Test(s) not found:")
toCheck.foreach(test => log.warn("\t" + test))
}
toCheck
}
lazy val includeTestsSet =
{
checkExistence()
Set(includeTests: _*)
}
val includeTestsSet = Set(includeTests: _*)
(test: String) => includeTestsSet.contains(test) || testFilters.exists(_.accept(test))
}

View File

@ -98,6 +98,7 @@ trait TaskManager{
val interactiveDependencyIndex = dependencyList.findIndexOf(_.interactive)
require(interactiveDependencyIndex < 0, "Dependency (at index " + interactiveDependencyIndex + ") is interactive. Interactive tasks cannot be dependencies.")
}
lazy val Empty = task { None}
}
object TaskManager
{