[Gradle] KotlinPluginLifecycle: Demote .enqueue to implementation
As .launch shall be the only entry point for running code within the context of the KotlinPluginLifecycle ^KT-58255 Verification Pending
This commit is contained in:
committed by
Space Team
parent
b53bf4b148
commit
7910e0d32c
+2
-4
@@ -333,8 +333,6 @@ internal interface KotlinPluginLifecycle {
|
||||
|
||||
val stage: Stage
|
||||
|
||||
fun enqueue(stage: Stage, action: KotlinPluginLifecycle.() -> Unit)
|
||||
|
||||
fun launch(block: suspend KotlinPluginLifecycle.() -> Unit)
|
||||
|
||||
suspend fun await(stage: Stage)
|
||||
@@ -347,7 +345,7 @@ internal interface KotlinPluginLifecycle {
|
||||
Implementation
|
||||
*/
|
||||
|
||||
private class KotlinPluginLifecycleImpl(override val project: Project) : KotlinPluginLifecycle {
|
||||
internal class KotlinPluginLifecycleImpl(override val project: Project) : KotlinPluginLifecycle {
|
||||
private val enqueuedActions: Map<Stage, ArrayDeque<KotlinPluginLifecycle.() -> Unit>> =
|
||||
Stage.values().associateWith { ArrayDeque() }
|
||||
|
||||
@@ -441,7 +439,7 @@ private class KotlinPluginLifecycleImpl(override val project: Project) : KotlinP
|
||||
project.configurationResultImpl.complete(ProjectConfigurationResult.Success)
|
||||
}
|
||||
|
||||
override fun enqueue(stage: Stage, action: KotlinPluginLifecycle.() -> Unit) {
|
||||
fun enqueue(stage: Stage, action: KotlinPluginLifecycle.() -> Unit) {
|
||||
if (stage < this.stage) {
|
||||
throw IllegalLifecycleException("Cannot enqueue Action for stage '$stage' in current stage '${this.stage}'")
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import kotlin.test.*
|
||||
class KotlinPluginLifecycleTest {
|
||||
|
||||
private val project = buildProjectWithMPP()
|
||||
private val lifecycle = project.kotlinPluginLifecycle
|
||||
private val lifecycle = project.kotlinPluginLifecycle as KotlinPluginLifecycleImpl
|
||||
|
||||
@Test
|
||||
fun `test - configure phase is executed right away`() {
|
||||
|
||||
Reference in New Issue
Block a user