aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka
diff options
context:
space:
mode:
authorDmitriy Dolovov <Dmitriy.Dolovov@jetbrains.com>2020-07-30 15:47:22 +0700
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-31 17:54:04 +0200
commit4dfe551d847759e5648b23ccaf3be5e5a09ffaf6 (patch)
tree456952de1551959169763e4bfc837960a38177b1 /runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka
parent4a90c3d9d21b97d67f4caa066e6894b1318914e9 (diff)
downloaddokka-4dfe551d847759e5648b23ccaf3be5e5a09ffaf6.tar.gz
dokka-4dfe551d847759e5648b23ccaf3be5e5a09ffaf6.tar.bz2
dokka-4dfe551d847759e5648b23ccaf3be5e5a09ffaf6.zip
Propagate default Kotlin/Native KLIBs to the Dokka classpath
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt26
1 files changed, 20 insertions, 6 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
index 1bfd2c78..efd4e466 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
+import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
import java.io.Serializable
@@ -161,12 +162,21 @@ class ConfigurationExtractor(private val project: Project) {
.compileKotlinTask as? KotlinCompile)
?.classpath?.files?.toList() ?: getClasspathFromRegularTask(compilation)
- private fun getClasspathFromRegularTask(compilation: KotlinCompilation<*>): List<File> =
- compilation
- .compileDependencyFiles
- .files
- .toList()
- .filter { it.exists() }
+ private fun getClasspathFromRegularTask(compilation: KotlinCompilation<*>): List<File> {
+ // explicit dependencies of the compilation
+ val ownDependencyFiles: Set<File> = compilation.compileDependencyFiles.files
+
+ // the dependencies provided by the platform (e.g. Kotlin/Native platform libs)
+ val platformDependencyFiles: Set<File> = if (compilation is KotlinNativeCompilation) {
+ compilation.target.project.configurations
+ .findByName(compilation.defaultSourceSet.implementationMetadataConfigurationName)
+ ?.let { nativePlatformDependencyConfiguration ->
+ nativePlatformDependencyConfiguration.files
+ } ?: emptySet()
+ } else emptySet()
+
+ return (ownDependencyFiles + platformDependencyFiles).toList().filter { it.exists() }
+ }
data class PlatformData(
val name: String?,
@@ -175,4 +185,8 @@ class ConfigurationExtractor(private val project: Project) {
val dependentSourceSets: List<String>,
val platform: String
) : Serializable
+
+ companion object {
+ private const val KOTLIN_NATIVE_HOME_PRIVATE_PROPERTY = "konanHome"
+ }
}