1
+ /*
2
+ * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
3
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4
+ */
5
+
6
+ @file:Suppress(" FunctionName" )
7
+
8
+ package org.jetbrains.kotlin.gradle.regressionTests
9
+
10
+ import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
11
+ import org.jetbrains.kotlin.gradle.plugin.ide.dependencyResolvers.resolveMetadata
12
+ import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution
13
+ import org.jetbrains.kotlin.gradle.util.buildProject
14
+ import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP
15
+ import org.jetbrains.kotlin.gradle.util.commonMain
16
+ import kotlin.test.Test
17
+
18
+ class KT59446TransformationOnTransitiveJavaDependencyTest {
19
+ @Test
20
+ fun `test - transform transitive java dependency` () {
21
+ val rootProject = buildProject()
22
+ val projectA = buildProjectWithMPP(projectBuilder = { withParent(rootProject).withName(" a" ) })
23
+ val projectB = buildProjectWithMPP(projectBuilder = { withParent(rootProject).withName(" b" ) })
24
+ val projectJava = buildProject(projectBuilder = { withParent(rootProject).withName(" java" ) })
25
+
26
+ /* *
27
+ * a -> b -> java
28
+ */
29
+ projectJava.plugins.apply (" java-library" )
30
+
31
+ projectA.multiplatformExtension.jvm()
32
+ projectB.multiplatformExtension.jvm()
33
+
34
+ projectB.multiplatformExtension.commonMain.dependencies {
35
+ api(project(" :java" ))
36
+ }
37
+
38
+ projectA.multiplatformExtension.commonMain.dependencies {
39
+ api(project(" :b" ))
40
+ }
41
+
42
+ /*
43
+ Call transformation
44
+ Exception was:
45
+ org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle$IllegalLifecycleException: Future was not completed yet 'Kotlin Plugin Lifecycle: (project ':java') *not started*'
46
+ at org.jetbrains.kotlin.gradle.utils.FutureImpl.getOrThrow(Future.kt:113)
47
+ at org.jetbrains.kotlin.gradle.utils.LenientFutureImpl.getOrThrow(Future.kt:138)
48
+ at org.jetbrains.kotlin.gradle.plugin.mpp.GranularMetadataTransformation.toModuleDependencyIdentifier(GranularMetadataTransformation.kt:303)
49
+ at org.jetbrains.kotlin.gradle.plugin.mpp.GranularMetadataTransformation.processDependency(GranularMetadataTransformation.kt:260)
50
+ */
51
+ projectA.multiplatformExtension.commonMain.resolveMetadata<MetadataDependencyResolution >()
52
+ }
53
+ }
0 commit comments