aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/test/kotlin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-06-30 23:06:03 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-06 17:59:15 +0200
commitb0e8622f374f6499058b0f083367b4a54512b702 (patch)
tree0fa641dc26bf1e7ed6497ee2340999e8ecc505ad /runners/gradle-plugin/src/test/kotlin
parentb0b418334535adc60ee80c3df1b2293dfcaad071 (diff)
downloaddokka-b0e8622f374f6499058b0f083367b4a54512b702.tar.gz
dokka-b0e8622f374f6499058b0f083367b4a54512b702.tar.bz2
dokka-b0e8622f374f6499058b0f083367b4a54512b702.zip
Enforce workspace unique SourceSetID
Diffstat (limited to 'runners/gradle-plugin/src/test/kotlin')
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt77
1 files changed, 77 insertions, 0 deletions
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt
index 0b80f4a2..da6daeea 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt
@@ -1,6 +1,9 @@
package org.jetbrains.dokka.gradle
+import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.testfixtures.ProjectBuilder
+import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -16,4 +19,78 @@ class KotlinDslDokkaTaskConfigurationTest {
assertEquals("test", dokkaTask.outputFormat)
}
}
+
+ @Test
+ fun `sourceSet dependsOn by String`() {
+ val project = ProjectBuilder.builder().build()
+ project.plugins.apply("org.jetbrains.dokka")
+
+ project.dokka {
+ dokkaSourceSets.run {
+ val commonMain = create("commonMain")
+ val jvmMain = create("jvmMain") {
+ it.dependsOn("commonMain")
+ }
+
+ assertEquals(
+ 0, commonMain.dependentSourceSets.size,
+ "Expected no dependent source set in commonMain"
+ )
+
+ assertEquals(
+ 1, jvmMain.dependentSourceSets.size,
+ "Expected only one dependent source set in jvmMain"
+ )
+
+ assertEquals(
+ commonMain.sourceSetID, jvmMain.dependentSourceSets.single(),
+ "Expected jvmMain to depend on commonMain"
+ )
+
+ assertEquals(
+ DokkaSourceSetID(project.path, "commonMain"), commonMain.sourceSetID
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `sourceSet dependsOn by DokkaSourceSet`() {
+ val project = ProjectBuilder.builder().build()
+ project.plugins.apply("org.jetbrains.dokka")
+
+ project.dokka {
+ dokkaSourceSets.run {
+ val commonMain = create("commonMain")
+ val jvmMain = create("jvmMain") {
+ it.dependsOn(commonMain)
+ }
+
+ assertEquals(
+ commonMain.sourceSetID, jvmMain.dependentSourceSets.single()
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `sourceSet dependsOn by KotlinSourceSet`() {
+ val project = ProjectBuilder.builder().build()
+ project.plugins.apply("org.jetbrains.dokka")
+ project.plugins.apply("org.jetbrains.kotlin.jvm")
+
+ val kotlin = project.extensions.getByName("kotlin") as KotlinJvmProjectExtension
+
+ project.dokka {
+ dokkaSourceSets.run {
+ val special = create("special") {
+ it.dependsOn(kotlin.sourceSets.getByName("main"))
+ }
+
+ assertEquals(
+ DokkaSourceSetID(project, "main"), special.dependentSourceSets.single()
+ )
+ }
+ }
+ }
}