[Gradle] Implement KotlinProjectSetupCoroutine

as util to easily launch configure action as suspending code

KT-61634
This commit is contained in:
Sebastian Sellmair
2023-10-16 18:26:16 +02:00
committed by Space Team
parent 628bd7a6be
commit c7b4057dab
@@ -1,3 +1,5 @@
@file:Suppress("FunctionName")
package org.jetbrains.kotlin.gradle.plugin
import org.gradle.api.Project
@@ -14,6 +16,10 @@ internal fun interface KotlinProjectSetupAction {
}
}
internal fun KotlinProjectSetupCoroutine(action: suspend Project.() -> Unit) = KotlinProjectSetupAction {
project.launch { action() }
}
internal fun Project.runKotlinProjectSetupActions() {
KotlinProjectSetupAction.extensionPoint[this].forEach { action ->
with(action) { invoke() }