[Gradle][MPP] Implement InternalKotlinSourceSet.compilations
This property can later be used to replace the slow compilationsBySourceSet util. KT-52726
This commit is contained in:
committed by
Space
parent
5a4f73be50
commit
0e6a074c9c
+1
@@ -32,6 +32,7 @@ abstract class AbstractCompilationDetails<T : KotlinCommonOptions> : Compilation
|
||||
directlyIncludedKotlinSourceSetsImpl.add(sourceSet)
|
||||
sourceSet.internal.withDependsOnClosure.forAll { withDependsOn ->
|
||||
kotlinSourceSetsClosureImpl.add(withDependsOn)
|
||||
withDependsOn.internal.addCompilation(compilation)
|
||||
}
|
||||
|
||||
whenSourceSetAdded(sourceSet)
|
||||
|
||||
+9
@@ -7,6 +7,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin.sources
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||
import org.jetbrains.kotlin.gradle.utils.MutableObservableSet
|
||||
import org.jetbrains.kotlin.gradle.utils.ObservableSet
|
||||
@@ -15,6 +16,7 @@ abstract class AbstractKotlinSourceSet : InternalKotlinSourceSet {
|
||||
private val dependsOnImpl = MutableObservableSet<KotlinSourceSet>()
|
||||
private val dependsOnClosureImpl = MutableObservableSet<KotlinSourceSet>()
|
||||
private val withDependsOnClosureImpl = MutableObservableSet<KotlinSourceSet>(this)
|
||||
private val compilationsImpl = MutableObservableSet<KotlinCompilation<*>>()
|
||||
|
||||
final override val dependsOn: ObservableSet<KotlinSourceSet>
|
||||
get() = dependsOnImpl
|
||||
@@ -25,6 +27,9 @@ abstract class AbstractKotlinSourceSet : InternalKotlinSourceSet {
|
||||
final override val withDependsOnClosure: ObservableSet<KotlinSourceSet>
|
||||
get() = withDependsOnClosureImpl
|
||||
|
||||
override val compilations: ObservableSet<KotlinCompilation<*>>
|
||||
get() = compilationsImpl
|
||||
|
||||
final override fun dependsOn(other: KotlinSourceSet) {
|
||||
if (other == this) return
|
||||
/*
|
||||
@@ -46,5 +51,9 @@ abstract class AbstractKotlinSourceSet : InternalKotlinSourceSet {
|
||||
}
|
||||
|
||||
protected open fun afterDependsOnAdded(other: KotlinSourceSet) = Unit
|
||||
|
||||
final override fun addCompilation(compilation: KotlinCompilation<*>) {
|
||||
compilationsImpl.add(compilation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin.sources
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||
import org.jetbrains.kotlin.gradle.utils.ObservableSet
|
||||
|
||||
@@ -17,4 +18,6 @@ internal interface InternalKotlinSourceSet : KotlinSourceSet {
|
||||
override val dependsOn: ObservableSet<KotlinSourceSet>
|
||||
val dependsOnClosure: ObservableSet<KotlinSourceSet>
|
||||
val withDependsOnClosure: ObservableSet<KotlinSourceSet>
|
||||
val compilations: ObservableSet<KotlinCompilation<*>>
|
||||
fun addCompilation(compilation: KotlinCompilation<*>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user