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 kotlin.test.Test
16
+
17
+ class KT59446TransformationOnTransitiveJavaDependencyTest {
18
+ @Test
19
+ fun `test - transform transitive java dependency` () {
20
+ val rootProject = buildProject()
21
+ val projectA = buildProjectWithMPP(projectBuilder = { withParent(rootProject).withName(" a" ) })
22
+ val projectB = buildProjectWithMPP(projectBuilder = { withParent(rootProject).withName(" b" ) })
23
+ val projectJava = buildProject(projectBuilder = { withParent(rootProject).withName(" java" ) })
24
+
25
+ /* *
26
+ * a -> b -> java
27
+ */
28
+ projectJava.plugins.apply (" java-library" )
29
+
30
+ projectA.multiplatformExtension.jvm()
31
+ projectB.multiplatformExtension.jvm()
32
+
33
+ projectB.multiplatformExtension.sourceSets.getByName(" commonMain" ).dependencies {
34
+ api(project(" :java" ))
35
+ }
36
+
37
+ projectA.multiplatformExtension.sourceSets.getByName(" commonMain" ).dependencies {
38
+ api(project(" :b" ))
39
+ }
40
+
41
+ /*
42
+ Call transformation
43
+ Exception was:
44
+ org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle$IllegalLifecycleException: Future was not completed yet 'Kotlin Plugin Lifecycle: (project ':java') *not started*'
45
+ at org.jetbrains.kotlin.gradle.utils.FutureImpl.getOrThrow(Future.kt:113)
46
+ at org.jetbrains.kotlin.gradle.utils.LenientFutureImpl.getOrThrow(Future.kt:138)
47
+ at org.jetbrains.kotlin.gradle.plugin.mpp.GranularMetadataTransformation.toModuleDependencyIdentifier(GranularMetadataTransformation.kt:303)
48
+ at org.jetbrains.kotlin.gradle.plugin.mpp.GranularMetadataTransformation.processDependency(GranularMetadataTransformation.kt:260)
49
+ */
50
+ projectA.multiplatformExtension.sourceSets.getByName(" commonMain" ).resolveMetadata<MetadataDependencyResolution >()
51
+ }
52
+ }
0 commit comments