From 9044761979d08b3b116c9f8416dfb42ae216898c Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Sat, 21 Aug 2021 15:57:01 +0200 Subject: Review comments + "unspecified" version fix --- .../src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt | 2 +- .../src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt | 2 ++ .../src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'runners/gradle-plugin/src/main/kotlin') diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt index cffc8bf3..76213f14 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt @@ -52,7 +52,7 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() { override fun buildDokkaConfiguration(): DokkaConfigurationImpl = DokkaConfigurationImpl( moduleName = moduleName.getSafe(), - moduleVersion = moduleVersion.getSafe(), + moduleVersion = moduleVersion.getValidVersionOrNull(), outputDir = outputDirectory.getSafe(), cacheRoot = cacheRoot.getSafe(), pluginsConfiguration = buildPluginsConfiguration(), diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt index b7e87c6c..51f6d297 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt @@ -19,3 +19,5 @@ internal inline fun Provider.getSafe(): T = if (typeOf().isMarkedNullable) orNull as T else get() +internal fun Provider.getValidVersionOrNull() = orNull?.takeIf { it != "unspecified" } + diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt index 6bb946c3..af2d3b1b 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt @@ -9,7 +9,7 @@ abstract class DokkaTask : AbstractDokkaLeafTask() { override fun buildDokkaConfiguration(): DokkaConfigurationImpl = DokkaConfigurationImpl( moduleName = moduleName.getSafe(), - moduleVersion = moduleVersion.orNull?.takeIf { it != "unspecified" }, + moduleVersion = moduleVersion.getValidVersionOrNull(), outputDir = outputDirectory.getSafe(), cacheRoot = cacheRoot.getSafe(), offlineMode = offlineMode.getSafe(), -- cgit