From 455f02f3bea3f391cd6e393d1ab4626abecc8639 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 4 May 2016 20:56:32 -0800 Subject: [PATCH] Comments. --- .../kotlin/com/beust/kobalt/internal/TaskManager.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt index 0cd71af6..df71a232 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt @@ -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 createGraph2(projectName: String, taskNames: List, nodeMap: Multimap, dependsOn: Multimap, @@ -162,6 +169,9 @@ class TaskManager @Inject constructor(val args: Args, val newToProcess = arrayListOf() val seen = hashSetOf() + // + // Reverse the always map so that tasks can be looked up. + // val always = ArrayListMultimap.create() 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, from: String, to: String, newToProcess: ArrayList, text: String) { val froms = nodeMap[from] froms.forEach { f: T ->