Skip to content

Commit

Permalink
[Gradle] Implement KT59446TransformationOnTransitiveJavaDependencyTest
Browse files Browse the repository at this point in the history
^KT-59446 In Progress

(cherry picked from commit ec46c82)
  • Loading branch information
sellmair authored and qodana-bot committed Jun 21, 2023
1 parent 54b11e3 commit bbf64b1
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/

@file:Suppress("FunctionName")

package org.jetbrains.kotlin.gradle.regressionTests

import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.ide.dependencyResolvers.resolveMetadata
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution
import org.jetbrains.kotlin.gradle.util.buildProject
import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP
import kotlin.test.Test

class KT59446TransformationOnTransitiveJavaDependencyTest {
@Test
fun `test - transform transitive java dependency`() {
val rootProject = buildProject()
val projectA = buildProjectWithMPP(projectBuilder = { withParent(rootProject).withName("a") })
val projectB = buildProjectWithMPP(projectBuilder = { withParent(rootProject).withName("b") })
val projectJava = buildProject(projectBuilder = { withParent(rootProject).withName("java") })

/**
* a -> b -> java
*/
projectJava.plugins.apply("java-library")

projectA.multiplatformExtension.jvm()
projectB.multiplatformExtension.jvm()

projectB.multiplatformExtension.sourceSets.getByName("commonMain").dependencies {
api(project(":java"))
}

projectA.multiplatformExtension.sourceSets.getByName("commonMain").dependencies {
api(project(":b"))
}

/*
Call transformation
Exception was:
org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle$IllegalLifecycleException: Future was not completed yet 'Kotlin Plugin Lifecycle: (project ':java') *not started*'
at org.jetbrains.kotlin.gradle.utils.FutureImpl.getOrThrow(Future.kt:113)
at org.jetbrains.kotlin.gradle.utils.LenientFutureImpl.getOrThrow(Future.kt:138)
at org.jetbrains.kotlin.gradle.plugin.mpp.GranularMetadataTransformation.toModuleDependencyIdentifier(GranularMetadataTransformation.kt:303)
at org.jetbrains.kotlin.gradle.plugin.mpp.GranularMetadataTransformation.processDependency(GranularMetadataTransformation.kt:260)
*/
projectA.multiplatformExtension.sourceSets.getByName("commonMain").resolveMetadata<MetadataDependencyResolution>()
}
}

0 comments on commit bbf64b1

Please sign in to comment.