mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Fix task dependencies.
This commit is contained in:
parent
c82f044bd3
commit
c125f45eda
2 changed files with 16 additions and 4 deletions
|
@ -148,12 +148,17 @@ abstract class BaseProjectRunner {
|
||||||
// runBefore and runAfter (task ordering) are only considered for explicit tasks (tasks that were
|
// runBefore and runAfter (task ordering) are only considered for explicit tasks (tasks that were
|
||||||
// explicitly requested by the user)
|
// explicitly requested by the user)
|
||||||
//
|
//
|
||||||
passedTasks.map { it.taskName }.let { taskNames ->
|
val passedTaskNames = passedTasks.map { it.taskName }.toSet()
|
||||||
|
passedTaskNames.let { taskNames ->
|
||||||
runBefore[taskName].forEach { from ->
|
runBefore[taskName].forEach { from ->
|
||||||
addEdge(result, from, taskName, newToProcess, "runBefore")
|
if (passedTaskNames.contains(from)) {
|
||||||
|
addEdge(result, from, taskName, newToProcess, "runBefore")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
runAfter[taskName].forEach { to ->
|
runAfter[taskName].forEach { to ->
|
||||||
addEdge(result, to, taskName, newToProcess, "runAfter")
|
if (passedTaskNames.contains(to)) {
|
||||||
|
addEdge(result, to, taskName, newToProcess, "runAfter")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seen.add(taskName)
|
seen.add(taskName)
|
||||||
|
|
|
@ -92,6 +92,13 @@ class TaskManagerTest : BaseTest() {
|
||||||
fun exampleInTheDocTest() {
|
fun exampleInTheDocTest() {
|
||||||
// KobaltLogger.LOG_LEVEL = 3
|
// KobaltLogger.LOG_LEVEL = 3
|
||||||
|
|
||||||
|
runTasks(listOf("clean"),
|
||||||
|
runAfter = TreeMultimap.create<String, String>().apply {
|
||||||
|
put("clean", "compile")
|
||||||
|
}).let { runTasks ->
|
||||||
|
assertThat(runTasks).isEqualTo(listOf("clean"))
|
||||||
|
}
|
||||||
|
|
||||||
runTasks(listOf("assemble"),
|
runTasks(listOf("assemble"),
|
||||||
dependsOn = TreeMultimap.create<String, String>().apply {
|
dependsOn = TreeMultimap.create<String, String>().apply {
|
||||||
put("assemble", "compile")
|
put("assemble", "compile")
|
||||||
|
@ -138,7 +145,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", "example"))
|
assertThat(runTasks).isEqualTo(listOf("clean", "compile"))
|
||||||
}
|
}
|
||||||
|
|
||||||
runTasks(listOf("compile", "example"),
|
runTasks(listOf("compile", "example"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue