mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Fix the task ordering bug.
This commit is contained in:
parent
699d9e99e7
commit
e99c277700
2 changed files with 20 additions and 0 deletions
|
@ -200,6 +200,16 @@ class TaskManager @Inject constructor(val args: Args,
|
|||
val seen = HashSet(allTaskInfos)
|
||||
val newTasks = hashSetOf<TaskInfo>()
|
||||
|
||||
// If at least two tasks were given, preserve the ordering by making each task depend on the
|
||||
// previous one, e.g. for "task1 task2 task3", add the edges "task2 -> task1" and "task3 -> task2"
|
||||
if (taskNames.size >= 2) {
|
||||
projects.forEach { project ->
|
||||
taskNames.zip(taskNames.subList(1, taskNames.size)).forEach { pair ->
|
||||
addEdge(TaskInfo(project.name, pair.second), TaskInfo(project.name, pair.first))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun maybeAdd(taskInfo: TaskInfo) {
|
||||
if (!seen.contains(taskInfo)) {
|
||||
newTasks.add(taskInfo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue