add reverse dependencies to 'get' output

This commit is contained in:
Mark Harrah 2011-02-08 20:36:29 -05:00
parent 66442a51df
commit f780d67a78
1 changed files with 9 additions and 1 deletions

View File

@ -120,10 +120,18 @@ object Project extends Init[Scope]
val cMap = compiled(structure.settings)(structure.delegates, structure.scopeLocal)
val related = cMap.keys.filter(k => k.key == key && k.scope != scope)
val depends = cMap.get(scoped) match { case Some(c) => c.dependencies.toSet; case None => Set.empty }
val reverse = reverseDependencies(cMap, scoped)
def printScopes(label: String, scopes: Iterable[ScopedKey[_]]) =
if(scopes.isEmpty) "" else scopes.map(display).mkString(label + ":\n\t", "\n\t", "\n")
value + "\n" + definedIn + "\n" + printScopes("Dependencies", depends) + printScopes("Related", related)
value + "\n" +
definedIn + "\n" +
printScopes("Dependencies", depends) +
printScopes("Reverse dependencies", reverse) +
printScopes("Related", related)
}
def reverseDependencies(cMap: CompiledMap, scoped: ScopedKey[_]): Iterable[ScopedKey[_]] =
for( (key,compiled) <- cMap; dep <- compiled.dependencies if dep == scoped) yield key
val SessionKey = AttributeKey[SessionSettings]("session-settings")
val StructureKey = AttributeKey[Load.BuildStructure]("build-structure")