diff options
author | Ryan Nett <JNett96@gmail.com> | 2021-05-04 10:16:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 19:16:07 +0200 |
commit | 430f2c3516a18aab9512bb21f44cca0429fd4601 (patch) | |
tree | 6d91e9cc6ec43b873f6960177aa499d23957f2dd /runners/gradle-plugin/src/main/kotlin/org | |
parent | 6a6017aec8bb502c674b988acb8b993774dd137a (diff) | |
download | dokka-430f2c3516a18aab9512bb21f44cca0429fd4601.tar.gz dokka-430f2c3516a18aab9512bb21f44cca0429fd4601.tar.bz2 dokka-430f2c3516a18aab9512bb21f44cca0429fd4601.zip |
Adds a supertype for leaf dokka tasks that defines dokkaSourceSets (#1891)
* Adds a supertype for leaf dokka tasks that defines dokkaSourceSets
* Extract implementation of dokkaSourceSets to AbstractDokkaLeafTask
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org')
4 files changed, 22 insertions, 29 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt new file mode 100644 index 00000000..96f43c77 --- /dev/null +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt @@ -0,0 +1,20 @@ +package org.jetbrains.dokka.gradle; + +import org.gradle.api.NamedDomainObjectContainer +import org.gradle.api.internal.plugins.DslObject +import org.gradle.api.tasks.Internal + +abstract class AbstractDokkaLeafTask() : AbstractDokkaTask() { + + @get:Internal + val dokkaSourceSets: NamedDomainObjectContainer<GradleDokkaSourceSetBuilder> = + project.container(GradleDokkaSourceSetBuilder::class.java, gradleDokkaSourceSetBuilderFactory()) + .also { container -> + DslObject(this).extensions.add("dokkaSourceSets", container) + project.kotlinOrNull?.sourceSets?.all { kotlinSourceSet -> + container.register(kotlinSourceSet.name) { dokkaSourceSet -> + dokkaSourceSet.configureWithKotlinSourceSet(kotlinSourceSet) + } + } + } +} diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt index b431cf98..ad17a67d 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt @@ -4,9 +4,6 @@ import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Nested -import org.jetbrains.dokka.DokkaBootstrap -import org.jetbrains.dokka.DokkaBootstrapImpl -import kotlin.reflect.KClass abstract class AbstractDokkaParentTask : AbstractDokkaTask() { 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 eaf4f495..48584786 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 @@ -6,19 +6,7 @@ import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Nested import org.jetbrains.dokka.* -abstract class DokkaTask : AbstractDokkaTask() { - - @get:Internal - val dokkaSourceSets: NamedDomainObjectContainer<GradleDokkaSourceSetBuilder> = - project.container(GradleDokkaSourceSetBuilder::class.java, gradleDokkaSourceSetBuilderFactory()) - .also { container -> - DslObject(this).extensions.add("dokkaSourceSets", container) - project.kotlinOrNull?.sourceSets?.all { kotlinSourceSet -> - container.register(kotlinSourceSet.name) { dokkaSourceSet -> - dokkaSourceSet.configureWithKotlinSourceSet(kotlinSourceSet) - } - } - } +abstract class DokkaTask : AbstractDokkaLeafTask() { /** * Only contains source sets that are marked with `isDocumented`. diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt index 4513cfea..39c0bab2 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt @@ -7,19 +7,7 @@ import org.gradle.api.tasks.Nested import org.jetbrains.dokka.DokkaConfigurationImpl import org.jetbrains.dokka.build -abstract class DokkaTaskPartial : AbstractDokkaTask() { - - @get:Internal - val dokkaSourceSets: NamedDomainObjectContainer<GradleDokkaSourceSetBuilder> = - project.container(GradleDokkaSourceSetBuilder::class.java, gradleDokkaSourceSetBuilderFactory()) - .also { container -> - DslObject(this).extensions.add("dokkaSourceSets", container) - project.kotlinOrNull?.sourceSets?.all { kotlinSourceSet -> - container.register(kotlinSourceSet.name) { dokkaSourceSet -> - dokkaSourceSet.configureWithKotlinSourceSet(kotlinSourceSet) - } - } - } +abstract class DokkaTaskPartial : AbstractDokkaLeafTask() { /** * Only contains source sets that are marked with `isDocumented`. |