From 22b71b823aa485edbb1881742b8f157834bbb6a6 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sun, 16 Oct 2011 22:37:24 -0400 Subject: [PATCH] convenience method for running tasks in aggregate --- main/Project.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main/Project.scala b/main/Project.scala index 146fd7ce7..7724dd473 100644 --- a/main/Project.scala +++ b/main/Project.scala @@ -75,11 +75,19 @@ final case class Extracted(structure: BuildStructure, session: SessionSettings, def runTask[T](key: TaskKey[T], state: State): (State, T) = { import EvaluateTask._ - val rkey = Project.mapScope(Scope.resolveScope(GlobalScope, currentRef.build, rootProject) )( key.scopedKey ) + val rkey = resolve(key.scopedKey) val value: Option[(State, Result[T])] = apply(structure, key.task.scopedKey, state, currentRef) val (newS, result) = getOrError(rkey.scope, rkey.key, value) (newS, processResult(result, newS.log)) } + def runAggregated[T](key: TaskKey[T], state: State): State = + { + val rkey = resolve(key.scopedKey) + val tasks = Aggregation.getTasks(rkey, structure, true) + Aggregation.runTasks(state, structure, tasks, Aggregation.Dummies(KNil, HNil), show = false )(showKey) + } + private[this] def resolve[T](key: ScopedKey[T]): ScopedKey[T] = + Project.mapScope(Scope.resolveScope(GlobalScope, currentRef.build, rootProject) )( key.scopedKey ) private def getOrError[T](scope: Scope, key: AttributeKey[_], value: Option[T])(implicit display: Show[ScopedKey[_]]): T = value getOrElse error(display(ScopedKey(scope, key)) + " is undefined.") private def getOrError[T](scope: Scope, key: AttributeKey[T])(implicit display: Show[ScopedKey[_]]): T =