mirror of https://github.com/sbt/sbt.git
display derived settings information in 'inspect'
This commit is contained in:
parent
1c741a2e06
commit
94f4d4e8c0
|
|
@ -92,14 +92,13 @@ trait Init[Scope]
|
||||||
def apply[T](k: ScopedKey[T]): ScopedKey[T] = k.copy(scope = f(k.scope))
|
def apply[T](k: ScopedKey[T]): ScopedKey[T] = k.copy(scope = f(k.scope))
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def plain[T](s: Setting[T]): Setting[T] = if(s.isDerived) new Setting(s.key, s.init, s.pos) else s
|
|
||||||
private[this] def derive(init: Seq[Setting[_]]): Seq[Setting[_]] =
|
private[this] def derive(init: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||||
{
|
{
|
||||||
import collection.mutable
|
import collection.mutable
|
||||||
val (derived, defs) = init.partition(_.isDerived)
|
val (derived, defs) = init.partition(_.isDerived)
|
||||||
val derivs = new mutable.HashMap[AttributeKey[_], mutable.ListBuffer[Setting[_]]]
|
val derivs = new mutable.HashMap[AttributeKey[_], mutable.ListBuffer[Setting[_]]]
|
||||||
for(s <- derived; d <- s.dependencies)
|
for(s <- derived; d <- s.dependencies)
|
||||||
derivs.getOrElseUpdate(d.key, new mutable.ListBuffer) += plain(s)
|
derivs.getOrElseUpdate(d.key, new mutable.ListBuffer) += s
|
||||||
|
|
||||||
val deriveFor = (sk: ScopedKey[_]) =>
|
val deriveFor = (sk: ScopedKey[_]) =>
|
||||||
derivs.get(sk.key).toList.flatMap(_.toList).map(_.setScope(sk.scope))
|
derivs.get(sk.key).toList.flatMap(_.toList).map(_.setScope(sk.scope))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue