mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57:12 -07:00
Reformat.
This commit is contained in:
parent
d1fb150ee1
commit
e831d33b82
3 changed files with 10 additions and 15 deletions
|
@ -15,15 +15,4 @@ abstract public class BasePlugin : Plugin {
|
|||
override var methodTasks = arrayListOf<Plugin.MethodTask>()
|
||||
override fun accept(project: Project) = true
|
||||
var plugins : Plugins by Delegates.notNull()
|
||||
|
||||
/**
|
||||
* Add a dynamic task.
|
||||
*/
|
||||
fun addTask(project: Project, name: String, description: String = "",
|
||||
runBefore: List<String> = arrayListOf<String>(),
|
||||
runAfter: List<String> = arrayListOf<String>(),
|
||||
task: (Project) -> TaskResult) {
|
||||
addGenericTask(project, name, description, runBefore, runAfter, task)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,12 +18,14 @@ public interface Plugin {
|
|||
val methodTasks : ArrayList<MethodTask>
|
||||
|
||||
fun addStaticTask(annotation: Task, project: Project, task: (Project) -> TaskResult) {
|
||||
addGenericTask(project, annotation.name, annotation.description, annotation.runBefore.toList(),
|
||||
addTask(project, annotation.name, annotation.description, annotation.runBefore.toList(),
|
||||
annotation.runAfter.toList(), task)
|
||||
}
|
||||
|
||||
fun addGenericTask(project: Project, name: String, description: String,
|
||||
runBefore: List<String>, runAfter: List<String>, task: (Project) -> TaskResult) {
|
||||
fun addTask(project: Project, name: String, description: String = "",
|
||||
runBefore: List<String> = arrayListOf<String>(),
|
||||
runAfter: List<String> = arrayListOf<String>(),
|
||||
task: (Project) -> TaskResult) {
|
||||
tasks.add(
|
||||
object : BasePluginTask(this, name, description, project) {
|
||||
override fun call(): TaskResult2<PluginTask> {
|
||||
|
|
|
@ -59,7 +59,11 @@ public class DynamicGraphExecutor<T>(val graph: DynamicGraph<T>,
|
|||
log(2, "Received task result ${taskResult}")
|
||||
n--
|
||||
graph.setStatus(taskResult.value,
|
||||
if (taskResult.success) DynamicGraph.Status.FINISHED else DynamicGraph.Status.ERROR)
|
||||
if (taskResult.success) {
|
||||
DynamicGraph.Status.FINISHED
|
||||
} else {
|
||||
DynamicGraph.Status.ERROR
|
||||
})
|
||||
} catch(ex: TimeoutException) {
|
||||
log(2, "Time out")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue