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

Task order fix.

This commit is contained in:
Cedric Beust 2016-08-10 23:20:29 -08:00
parent 87c4dead2c
commit 4e3d727da6
3 changed files with 6 additions and 10 deletions

View file

@ -150,14 +150,10 @@ abstract class BaseProjectRunner {
// //
passedTasks.map { it.taskName }.let { taskNames -> passedTasks.map { it.taskName }.let { taskNames ->
runBefore[taskName].forEach { from -> runBefore[taskName].forEach { from ->
if (taskNames.contains(from)) {
addEdge(result, from, taskName, newToProcess, "runBefore") addEdge(result, from, taskName, newToProcess, "runBefore")
} }
}
runAfter[taskName].forEach { to -> runAfter[taskName].forEach { to ->
if (taskNames.contains(to)) { addEdge(result, to, taskName, newToProcess, "runAfter")
addEdge(result, taskName, to, newToProcess, "runAfter")
}
} }
} }
seen.add(taskName) seen.add(taskName)

View file

@ -46,7 +46,7 @@ class TaskManager @Inject constructor(val args: Args,
/** /**
* Ordering: task2 runs after task 1. * Ordering: task2 runs after task 1.
*/ */
fun runAfter(task1: String, task2: String) = runAfter.put(task2, task1) fun runAfter(task1: String, task2: String) = runAfter.put(task1, task2)
/** /**
* Wrapper task: task2 runs after task 1. * Wrapper task: task2 runs after task 1.

View file

@ -126,7 +126,7 @@ class TaskManagerTest : BaseTest() {
put("compile", "clean") put("compile", "clean")
}, },
runAfter = TreeMultimap.create<String, String>().apply { runAfter = TreeMultimap.create<String, String>().apply {
put("compile", "example") put("example", "compile")
}).let { runTasks -> }).let { runTasks ->
assertThat(runTasks).isEqualTo(listOf("clean", "compile")) assertThat(runTasks).isEqualTo(listOf("clean", "compile"))
} }
@ -138,7 +138,7 @@ class TaskManagerTest : BaseTest() {
runBefore = TreeMultimap.create<String, String>().apply { runBefore = TreeMultimap.create<String, String>().apply {
put("compile", "example") put("compile", "example")
}).let { runTasks -> }).let { runTasks ->
assertThat(runTasks).isEqualTo(listOf("clean", "compile")) assertThat(runTasks).isEqualTo(listOf("clean", "compile", "example"))
} }
runTasks(listOf("compile", "example"), runTasks(listOf("compile", "example"),
@ -158,7 +158,7 @@ class TaskManagerTest : BaseTest() {
runAfter = TreeMultimap.create<String, String>().apply { runAfter = TreeMultimap.create<String, String>().apply {
put("compile", "example") put("compile", "example")
}).let { runTasks -> }).let { runTasks ->
assertThat(runTasks).isEqualTo(listOf("clean", "example", "compile")) assertThat(runTasks).isEqualTo(listOf("clean", "compile", "example"))
} }
} }