mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Merge pull request #252 from DevCharly/issue-244-fix
fix #244: support "project related tasks"
This commit is contained in:
commit
35f4117ca9
1 changed files with 17 additions and 4 deletions
|
@ -81,7 +81,17 @@ class TaskManager @Inject constructor(val args: Args,
|
|||
}
|
||||
|
||||
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)
|
||||
return runProjects(taskInfos, projectsToRun)
|
||||
}
|
||||
|
@ -269,9 +279,6 @@ class TaskManager @Inject constructor(val args: Args,
|
|||
// Keep only the tasks we need to run.
|
||||
//
|
||||
val taskInfos = passedTasks.filter {
|
||||
if (!nodeMap.keys().contains(it.taskName)) {
|
||||
throw KobaltException("Unknown task: $it")
|
||||
}
|
||||
it.matches(projectName)
|
||||
}
|
||||
|
||||
|
@ -485,6 +492,12 @@ class TaskManager @Inject constructor(val args: Args,
|
|||
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.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue