mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 08:38:13 -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 var methodTasks = arrayListOf<Plugin.MethodTask>()
|
||||||
override fun accept(project: Project) = true
|
override fun accept(project: Project) = true
|
||||||
var plugins : Plugins by Delegates.notNull()
|
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>
|
val methodTasks : ArrayList<MethodTask>
|
||||||
|
|
||||||
fun addStaticTask(annotation: Task, project: Project, task: (Project) -> TaskResult) {
|
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)
|
annotation.runAfter.toList(), task)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addGenericTask(project: Project, name: String, description: String,
|
fun addTask(project: Project, name: String, description: String = "",
|
||||||
runBefore: List<String>, runAfter: List<String>, task: (Project) -> TaskResult) {
|
runBefore: List<String> = arrayListOf<String>(),
|
||||||
|
runAfter: List<String> = arrayListOf<String>(),
|
||||||
|
task: (Project) -> TaskResult) {
|
||||||
tasks.add(
|
tasks.add(
|
||||||
object : BasePluginTask(this, name, description, project) {
|
object : BasePluginTask(this, name, description, project) {
|
||||||
override fun call(): TaskResult2<PluginTask> {
|
override fun call(): TaskResult2<PluginTask> {
|
||||||
|
|
|
@ -59,7 +59,11 @@ public class DynamicGraphExecutor<T>(val graph: DynamicGraph<T>,
|
||||||
log(2, "Received task result ${taskResult}")
|
log(2, "Received task result ${taskResult}")
|
||||||
n--
|
n--
|
||||||
graph.setStatus(taskResult.value,
|
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) {
|
} catch(ex: TimeoutException) {
|
||||||
log(2, "Time out")
|
log(2, "Time out")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue