aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-08-25 20:55:41 +0200
committerGitHub <noreply@github.com>2021-08-25 20:55:41 +0200
commitf2adc0a50462a63f7e1901db2e58077001acd622 (patch)
treea0a21d3c99b2d8cbe77ebf95d865aabd36d6598f /runners
parent939cbcd4d867961516da71f7c55d037ec88cb7f3 (diff)
parentefc9f92b0ac083c73ac494c95b530305ac04115a (diff)
downloaddokka-f2adc0a50462a63f7e1901db2e58077001acd622.tar.gz
dokka-f2adc0a50462a63f7e1901db2e58077001acd622.tar.bz2
dokka-f2adc0a50462a63f7e1901db2e58077001acd622.zip
Merge pull request #2066 from Kotlin/webhelp-like-frontend
Webhelp like frontend
Diffstat (limited to 'runners')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaProperty.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt2
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt22
4 files changed, 22 insertions, 5 deletions
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 de503476..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,6 +52,7 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
override fun buildDokkaConfiguration(): DokkaConfigurationImpl = DokkaConfigurationImpl(
moduleName = moduleName.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 <reified T> Provider<T>.getSafe(): T =
if (typeOf<T>().isMarkedNullable) orNull as T
else get()
+internal fun Provider<String>.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(),
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
index 54f01fa5..73afdb43 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
@@ -6,10 +6,7 @@ import org.gradle.kotlin.dsl.*
import org.gradle.testfixtures.ProjectBuilder
import org.jetbrains.dokka.*
import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFailsWith
-import kotlin.test.assertTrue
+import kotlin.test.*
class DokkaMultiModuleTaskTest {
@@ -64,6 +61,7 @@ class DokkaMultiModuleTaskTest {
}
multiModuleTask.apply {
+ moduleVersion by "1.5.0"
moduleName by "custom Module Name"
outputDirectory by project.buildDir.resolve("customOutputDirectory")
cacheRoot by File("customCacheRoot")
@@ -77,6 +75,7 @@ class DokkaMultiModuleTaskTest {
assertEquals(
DokkaConfigurationImpl(
moduleName = "custom Module Name",
+ moduleVersion = "1.5.0",
outputDir = multiModuleTask.project.buildDir.resolve("customOutputDirectory"),
cacheRoot = File("customCacheRoot"),
pluginsConfiguration = mutableListOf(PluginConfigurationImpl("pluginA", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)),
@@ -98,6 +97,21 @@ class DokkaMultiModuleTaskTest {
}
@Test
+ fun `multimodule task should not include unspecified version`(){
+ childDokkaTask.apply {
+ dokkaSourceSets.create("main")
+ dokkaSourceSets.create("test")
+ }
+
+ multiModuleTask.apply {
+ moduleVersion by "unspecified"
+ }
+
+ val dokkaConfiguration = multiModuleTask.buildDokkaConfiguration()
+ assertNull(dokkaConfiguration.moduleVersion)
+ }
+
+ @Test
fun `setting dokkaTaskNames declares proper task dependencies`() {
val dependenciesInitial = multiModuleTask.taskDependencies.getDependencies(multiModuleTask).toSet()
assertEquals(1, dependenciesInitial.size, "Expected one dependency")