mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
fix #244: support "project related tasks" (e.g. dynamic task defined for a single project)
This commit is contained in:
parent
9271aaf398
commit
8399171d3f
1 changed files with 17 additions and 1 deletions
|
@ -79,7 +79,17 @@ class TaskManager @Inject constructor(val args: Args,
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runTargets(passedTaskNames: List<String>, allProjects: List<Project>): RunTargetResult {
|
fun runTargets(passedTaskNames: List<String>, allProjects: List<Project>): RunTargetResult {
|
||||||
val taskInfos = calculateDependentTaskNames(passedTaskNames, allProjects)
|
// Check whether tasks passed at command line exist
|
||||||
|
passedTaskNames.forEach {
|
||||||
|
if (!hasTask(TaskInfo(it)))
|
||||||
|
throw KobaltException("Unknown task: $it")
|
||||||
|
}
|
||||||
|
|
||||||
|
var taskInfos = calculateDependentTaskNames(passedTaskNames, allProjects)
|
||||||
|
|
||||||
|
// Remove not existing tasks (e.g. dynamic task defined for a single project)
|
||||||
|
taskInfos = taskInfos.filter { hasTask(it) }
|
||||||
|
|
||||||
val projectsToRun = findProjectsToRun(taskInfos, allProjects)
|
val projectsToRun = findProjectsToRun(taskInfos, allProjects)
|
||||||
return runProjects(taskInfos, projectsToRun)
|
return runProjects(taskInfos, projectsToRun)
|
||||||
}
|
}
|
||||||
|
@ -483,6 +493,12 @@ class TaskManager @Inject constructor(val args: Args,
|
||||||
alwaysRunAfter.forEach { alwaysRunAfter(it, name) }
|
alwaysRunAfter.forEach { alwaysRunAfter(it, name) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasTask(ti: TaskInfo): Boolean {
|
||||||
|
val taskName = ti.taskName
|
||||||
|
val project = ti.project
|
||||||
|
return annotationTasks.any { taskName == it.name && (project == null || project == it.project.name) }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked by the server whenever it's done processing a command so the state can be reset for the next command.
|
* Invoked by the server whenever it's done processing a command so the state can be reset for the next command.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue