diff options
Diffstat (limited to 'runners/gradle-plugin/src')
2 files changed, 26 insertions, 1 deletions
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 d72ec0f9..2de95493 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 @@ -341,4 +341,10 @@ open class DokkaTask : DefaultTask(), Configurable { null } } -}
\ No newline at end of file +} + +fun Project.dokka(configuration: DokkaTask.() -> Unit) { + tasks.withType(DokkaTask::class.java) { dokkaTask -> + dokkaTask.configuration() + } +} 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 new file mode 100644 index 00000000..0b80f4a2 --- /dev/null +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt @@ -0,0 +1,19 @@ +package org.jetbrains.dokka.gradle + +import org.gradle.testfixtures.ProjectBuilder +import kotlin.test.Test +import kotlin.test.assertEquals + +class KotlinDslDokkaTaskConfigurationTest { + + @Test + fun `configure project using dokka extension function`() { + val project = ProjectBuilder.builder().build() + project.plugins.apply("org.jetbrains.dokka") + project.dokka { this.outputFormat = "test" } + + project.tasks.withType(DokkaTask::class.java).forEach { dokkaTask -> + assertEquals("test", dokkaTask.outputFormat) + } + } +} |