task axis delegation

This commit is contained in:
Mark Harrah 2011-05-23 08:13:13 -04:00
parent 26ea59a389
commit c5a312cedc
3 changed files with 12 additions and 5 deletions

View File

@ -52,7 +52,7 @@ object Load
rootProject,
project => projectInherit(lb, project),
(project, config) => configInherit(lb, project, config, rootProject),
(project, task) => Nil,
task => task.extend,
(project, extra) => Nil
)
}

View File

@ -123,7 +123,7 @@ object Scope
rootProject: URI => String,
projectInherit: ProjectRef => Seq[ProjectRef],
configInherit: (ResolvedReference, ConfigKey) => Seq[ConfigKey],
taskInherit: (ResolvedReference, AttributeKey[_]) => Seq[AttributeKey[_]],
taskInherit: AttributeKey[_] => Seq[AttributeKey[_]],
extraInherit: (ResolvedReference, AttributeMap) => Seq[AttributeMap]): Scope => Seq[Scope] =
{
val index = delegates(refs, configurations, projectInherit, configInherit)
@ -134,7 +134,7 @@ object Scope
resolve: Reference => ResolvedReference,
index: DelegateIndex,
rootProject: URI => String,
taskInherit: (ResolvedReference, AttributeKey[_]) => Seq[AttributeKey[_]],
taskInherit: AttributeKey[_] => Seq[AttributeKey[_]],
extraInherit: (ResolvedReference, AttributeMap) => Seq[AttributeMap])(rawScope: Scope): Seq[Scope] =
{
val scope = Scope.replaceThis(GlobalScope)(rawScope)
@ -144,7 +144,7 @@ object Scope
val p = px.toOption getOrElse resolvedProj
val configProj = p match { case pr: ProjectRef => pr; case br: BuildRef => ProjectRef(br.build, rootProject(br.build)) }
val cLin = scope.config match { case Select(conf) => index.config(configProj, conf); case _ => withGlobalAxis(scope.config) }
val tLin = withGlobalAxis(scope.task)
val tLin = scope.task match { case t @ Select(task) => linearize(t)(taskInherit); case _ => withGlobalAxis(scope.task) }
val eLin = withGlobalAxis(scope.extra)
for(c <- cLin; t <- tLin; e <- eLin) yield Scope(px, c, t, e)
}
@ -185,7 +185,6 @@ object Scope
{
val refDelegates = withRawBuilds(linearize(Select(ref), false)(projectInherit))
val configs = confs map { c => axisDelegates(configInherit, ref, c) }
val tasks = confs map { c => axisDelegates(configInherit, ref, c) }
new ProjectDelegates(ref, refDelegates, configs.toMap)
}
def axisDelegates[T](direct: (ResolvedReference, T) => Seq[T], ref: ResolvedReference, init: T): (T, Seq[ScopeAxis[T]]) =

View File

@ -11,6 +11,7 @@ import Types._
sealed trait AttributeKey[T] {
def label: String
def description: Option[String]
def extend: Seq[AttributeKey[_]]
override final def toString = label
}
object AttributeKey
@ -18,10 +19,17 @@ object AttributeKey
def apply[T](name: String): AttributeKey[T] = new AttributeKey[T] {
def label = name
def description = None
def extend = Nil
}
def apply[T](name: String, description0: String): AttributeKey[T] = new AttributeKey[T] {
def label = name
def description = Some(description0)
def extend = Nil
}
def apply[T](name: String, description0: String, extend0: Seq[AttributeKey[_]]): AttributeKey[T] = new AttributeKey[T] {
def label = name
def description = Some(description0)
def extend = extend0
}
}