Skip to content

Commit 7910e0d

Browse files
sellmairSpace Team
authored and
Space Team
committed
[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
1 parent b53bf4b commit 7910e0d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPluginLifecycle.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ internal interface KotlinPluginLifecycle {
333333

334334
val stage: Stage
335335

336-
fun enqueue(stage: Stage, action: KotlinPluginLifecycle.() -> Unit)
337-
338336
fun launch(block: suspend KotlinPluginLifecycle.() -> Unit)
339337

340338
suspend fun await(stage: Stage)
@@ -347,7 +345,7 @@ internal interface KotlinPluginLifecycle {
347345
Implementation
348346
*/
349347

350-
private class KotlinPluginLifecycleImpl(override val project: Project) : KotlinPluginLifecycle {
348+
internal class KotlinPluginLifecycleImpl(override val project: Project) : KotlinPluginLifecycle {
351349
private val enqueuedActions: Map<Stage, ArrayDeque<KotlinPluginLifecycle.() -> Unit>> =
352350
Stage.values().associateWith { ArrayDeque() }
353351

@@ -441,7 +439,7 @@ private class KotlinPluginLifecycleImpl(override val project: Project) : KotlinP
441439
project.configurationResultImpl.complete(ProjectConfigurationResult.Success)
442440
}
443441

444-
override fun enqueue(stage: Stage, action: KotlinPluginLifecycle.() -> Unit) {
442+
fun enqueue(stage: Stage, action: KotlinPluginLifecycle.() -> Unit) {
445443
if (stage < this.stage) {
446444
throw IllegalLifecycleException("Cannot enqueue Action for stage '$stage' in current stage '${this.stage}'")
447445
}

libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/KotlinPluginLifecycleTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import kotlin.test.*
2828
class KotlinPluginLifecycleTest {
2929

3030
private val project = buildProjectWithMPP()
31-
private val lifecycle = project.kotlinPluginLifecycle
31+
private val lifecycle = project.kotlinPluginLifecycle as KotlinPluginLifecycleImpl
3232

3333
@Test
3434
fun `test - configure phase is executed right away`() {

0 commit comments

Comments
 (0)