diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-15 09:14:01 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-15 12:45:22 +0200 |
commit | 543155602b233639753fd5973a23b730e021d431 (patch) | |
tree | 288a11fff65913f187781939bff3a7afb637c91f /runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka | |
parent | 06ae216a4e23ee53907914731fc2fbc5443c2538 (diff) | |
download | dokka-543155602b233639753fd5973a23b730e021d431.tar.gz dokka-543155602b233639753fd5973a23b730e021d431.tar.bz2 dokka-543155602b233639753fd5973a23b730e021d431.zip |
ConfigurationExtractor: Gracefully handle projects without Kotlin project applied
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.kt | 14 |
1 files changed, 10 insertions, 4 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 c9693467..1bfd2c78 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 @@ -19,11 +19,17 @@ import java.io.File import java.io.Serializable class ConfigurationExtractor(private val project: Project) { - fun extractConfiguration(sourceSetName: String): PlatformData? { - val projectExtension = project.extensions.getByType(KotlinProjectExtension::class.java) - val sourceSet = projectExtension.sourceSets.findByName(sourceSetName) - ?: run { project.logger.error("No source set with name '$sourceSetName' found"); return null } + val projectExtension = project.extensions.findByType(KotlinProjectExtension::class.java) ?: run { + project.logger.error("Missing kotlin project extension") + return null + } + + val sourceSet = projectExtension.sourceSets.findByName(sourceSetName) ?: run { + project.logger.error("No source set with name '$sourceSetName' found") + return null + } + val compilation = try { when (projectExtension) { is KotlinMultiplatformExtension -> { |