From 543155602b233639753fd5973a23b730e021d431 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 15 Jul 2020 09:14:01 +0200 Subject: ConfigurationExtractor: Gracefully handle projects without Kotlin project applied --- .../org/jetbrains/dokka/gradle/ConfigurationExtractor.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka') 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 -> { -- cgit