aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin/org/jetbrains
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt34
1 files changed, 22 insertions, 12 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt
index fdb4642c..1d06e608 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinCompilationUtils.kt
@@ -10,26 +10,36 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
internal typealias KotlinCompilation =
org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<KotlinCommonOptions>
+internal fun Project.compilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
+ //KT-45412 Make sure .kotlinSourceSets and .allKotlinSourceSets include the default source set
+ return allCompilationsOf(sourceSet).filter { compilation ->
+ sourceSet in compilation.kotlinSourceSets || sourceSet == compilation.defaultSourceSet
+ }
+}
+
internal fun Project.allCompilationsOf(
sourceSet: KotlinSourceSet
): List<KotlinCompilation> {
return when (val kotlin = kotlin) {
- is KotlinMultiplatformExtension -> kotlin.allCompilationsOf(sourceSet)
- is KotlinSingleTargetExtension -> kotlin.allCompilationsOf(sourceSet)
+ is KotlinMultiplatformExtension -> allCompilationsOf(kotlin, sourceSet)
+ is KotlinSingleTargetExtension<*> -> allCompilationsOf(kotlin, sourceSet)
else -> emptyList()
}
}
-internal fun Project.compilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
- //KT-45412 Make sure .kotlinSourceSets and .allKotlinSourceSets include the default source set
- return allCompilationsOf(sourceSet).filter { compilation -> sourceSet in compilation.kotlinSourceSets || sourceSet == compilation.defaultSourceSet }
-}
-
-private fun KotlinMultiplatformExtension.allCompilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
- val allCompilations = targets.flatMap { target -> target.compilations }
- return allCompilations.filter { compilation -> sourceSet in compilation.allKotlinSourceSets || sourceSet == compilation.defaultSourceSet }
+private fun allCompilationsOf(
+ kotlin: KotlinMultiplatformExtension,
+ sourceSet: KotlinSourceSet
+): List<KotlinCompilation> {
+ val allCompilations = kotlin.targets.flatMap { target -> target.compilations }
+ return allCompilations.filter { compilation ->
+ sourceSet in compilation.allKotlinSourceSets || sourceSet == compilation.defaultSourceSet
+ }
}
-private fun KotlinSingleTargetExtension.allCompilationsOf(sourceSet: KotlinSourceSet): List<KotlinCompilation> {
- return target.compilations.filter { compilation -> sourceSet in compilation.allKotlinSourceSets }
+private fun allCompilationsOf(
+ kotlin: KotlinSingleTargetExtension<*>,
+ sourceSet: KotlinSourceSet
+): List<KotlinCompilation> {
+ return kotlin.target.compilations.filter { compilation -> sourceSet in compilation.allKotlinSourceSets }
}