KT-MR-5666 Keep dep graph utils internal; reuse transitive closure utils
This commit is contained in:
+2
-8
@@ -15,6 +15,7 @@ import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.bundling.AbstractArchiveTask
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.commonizer.util.transitiveClosure
|
||||
import org.jetbrains.kotlin.gradle.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptionsImpl
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
@@ -69,14 +70,7 @@ interface CompilationDetailsWithRuntime<T : KotlinCommonOptions> : CompilationDe
|
||||
}
|
||||
|
||||
internal val CompilationDetails<*>.associateWithTransitiveClosure: Iterable<CompilationDetails<*>>
|
||||
get() = mutableSetOf<CompilationDetails<*>>().apply {
|
||||
fun visit(other: CompilationDetails<*>) {
|
||||
if (add(other)) {
|
||||
other.associateCompilations.forEach(::visit)
|
||||
}
|
||||
}
|
||||
associateCompilations.forEach(::visit)
|
||||
}
|
||||
get() = transitiveClosure(this) { associateCompilations }
|
||||
|
||||
open class DefaultCompilationDetails<T : KotlinCommonOptions>(
|
||||
final override val target: KotlinTarget,
|
||||
|
||||
-11
@@ -112,14 +112,3 @@ class GradleDependencyGraph(
|
||||
override val root: GradleDependencyGraphNode
|
||||
) : DependencyGraphResolution.DependencyGraph(requestingModule, root)
|
||||
|
||||
val GradleDependencyGraph.allGraphNodes: Iterable<GradleDependencyGraphNode>
|
||||
get() = mutableSetOf<GradleDependencyGraphNode>().apply {
|
||||
fun visit(node: GradleDependencyGraphNode) {
|
||||
if (add(node))
|
||||
node.dependenciesByFragment.values.flatten().forEach(::visit)
|
||||
}
|
||||
visit(root)
|
||||
}
|
||||
|
||||
val GradleDependencyGraph.allDependencyModules: Iterable<KotlinModule>
|
||||
get() = allGraphNodes.map { it.module }.filter { it != root.module }
|
||||
|
||||
+1
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.gradle.dsl.pm20Extension
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.GradleModuleVariantResolver
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.isMain
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.allDependencyModules
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.disambiguateName
|
||||
import org.jetbrains.kotlin.gradle.utils.filesProvider
|
||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util
|
||||
|
||||
import org.jetbrains.kotlin.commonizer.util.transitiveClosure
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleDependencyGraph
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.GradleDependencyGraphNode
|
||||
import org.jetbrains.kotlin.project.model.KotlinModule
|
||||
|
||||
internal val GradleDependencyGraph.allDependencyNodes: Iterable<GradleDependencyGraphNode>
|
||||
get() = transitiveClosure(root) { dependenciesByFragment.values.flatten() }
|
||||
|
||||
internal val GradleDependencyGraph.allDependencyModules: Iterable<KotlinModule>
|
||||
get() = allDependencyNodes.map { it.module }
|
||||
Reference in New Issue
Block a user