Skip to content

Commit 1f70ebb

Browse files
antohabySpace Team
authored and
Space Team
committed
[Gradle] Fix resolve friend paths to be able to detect late associateWith calls
1 parent 1b0ab7d commit 1f70ebb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/compilationImpl/KotlinCompilationFriendPathsResolver.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ internal class DefaultKotlinCompilationFriendPathsResolver(
2525

2626
override fun resolveFriendPaths(compilation: InternalKotlinCompilation<*>): Iterable<FileCollection> {
2727
return mutableListOf<FileCollection>().apply {
28-
compilation.allAssociatedCompilations.forEach {
29-
add(it.output.classesDirs)
28+
val friendsFromAssociatedCompilations = compilation.project.files()
29+
compilation.allAssociatedCompilations.forAll {
30+
friendsFromAssociatedCompilations.from(it.output.classesDirs)
3031
// Adding classes that could be produced to non-default destination for JVM target
3132
// Check KotlinSourceSetProcessor for details
3233
@Suppress("UNCHECKED_CAST")
33-
add(
34-
compilation.project.files(
35-
(it.compileTaskProvider as TaskProvider<KotlinCompileTool>).flatMap { task -> task.destinationDirectory }
36-
)
37-
)
34+
val compileTaskOutput = (it.compileTaskProvider as TaskProvider<KotlinCompileTool>)
35+
.flatMap { task -> task.destinationDirectory }
36+
friendsFromAssociatedCompilations.from(compileTaskOutput)
3837
}
38+
add(friendsFromAssociatedCompilations)
3939
add(friendArtifactResolver.resolveFriendArtifacts(compilation))
4040
}
4141
}

0 commit comments

Comments
 (0)