1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Comments.

This commit is contained in:
Cedric Beust 2016-05-04 20:56:32 -08:00
parent 0f34f548a9
commit 455f02f3be

View file

@ -147,6 +147,13 @@ class TaskManager @Inject constructor(val args: Args,
val LOG_LEVEL = 3
/**
* Create a graph representing the tasks and their dependencies. That graph will then be run
* in topological order.
*
* @taskNames is the list of tasks requested by the user. @nodeMap maps these tasks to the nodes
* we'll be adding to the graph while @toName extracts the name of a node.
*/
@VisibleForTesting
fun <T> createGraph2(projectName: String, taskNames: List<String>, nodeMap: Multimap<String, T>,
dependsOn: Multimap<String, String>,
@ -162,6 +169,9 @@ class TaskManager @Inject constructor(val args: Args,
val newToProcess = arrayListOf<T>()
val seen = hashSetOf<String>()
//
// Reverse the always map so that tasks can be looked up.
//
val always = ArrayListMultimap.create<String, String>()
alwaysRunAfter.keySet().forEach { k ->
alwaysRunAfter[k].forEach { v ->
@ -183,6 +193,9 @@ class TaskManager @Inject constructor(val args: Args,
while (toProcess.size > 0) {
/**
* Add an edge from @param from to all its tasks.
*/
fun addEdge(result: DynamicGraph<T>, from: String, to: String, newToProcess: ArrayList<T>, text: String) {
val froms = nodeMap[from]
froms.forEach { f: T ->