fix accumulation of loggers in tests. allows custom test configurations to extend Test

This commit is contained in:
Mark Harrah 2011-06-25 09:37:55 -04:00
parent 7e37689c5b
commit e73ebda27d
1 changed files with 4 additions and 3 deletions

View File

@ -247,11 +247,12 @@ object Defaults extends BuildCommon
testOnly <<= testOnlyTask testOnly <<= testOnlyTask
) )
lazy val TaskGlobal: Scope = ThisScope.copy(task = Global)
def testTaskOptions(key: Scoped): Seq[Setting[_]] = inTask(key)( Seq( def testTaskOptions(key: Scoped): Seq[Setting[_]] = inTask(key)( Seq(
testListeners <<= (streams, resolvedScoped, streamsManager, logBuffered in key, testListeners) map { (s, sco, sm, buff, ls) => testListeners <<= (streams, resolvedScoped, streamsManager, logBuffered, testListeners in TaskGlobal) map { (s, sco, sm, buff, ls) =>
TestLogger(s.log, testLogger(sm, test in sco.scope), buff) +: ls TestLogger(s.log, testLogger(sm, test in sco.scope), buff) +: ls
}, },
testOptions <<= (testOptions, testListeners) map { (options, ls) => Tests.Listeners(ls) +: options } testOptions <<= (testOptions in TaskGlobal, testListeners) map { (options, ls) => Tests.Listeners(ls) +: options }
) ) ) )
def testLogger(manager: Streams, baseKey: Scoped)(tdef: TestDefinition): Logger = def testLogger(manager: Streams, baseKey: Scoped)(tdef: TestDefinition): Logger =
{ {
@ -326,7 +327,7 @@ object Defaults extends BuildCommon
def pairID[A,B] = (a: A, b: B) => (a,b) def pairID[A,B] = (a: A, b: B) => (a,b)
def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File,String)]]]) = def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File,String)]]]) =
inTask(key)( Seq( inTask(key)( Seq(
key in ThisScope.copy(task = Global) <<= packageTask, key in TaskGlobal <<= packageTask,
packageConfiguration <<= packageConfigurationTask, packageConfiguration <<= packageConfigurationTask,
mappings <<= mappingsTask, mappings <<= mappingsTask,
packagedArtifact <<= (artifact, key) map pairID, packagedArtifact <<= (artifact, key) map pairID,