From 02ccae10e3f717c330dae5d87b49a0e72f798905 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 28 Aug 2020 11:28:54 +0200 Subject: Re-use includes form child tasks for all modules page generation --- .../jetbrains/dokka/gradle/DokkaMultiModuleTask.kt | 27 ++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'runners/gradle-plugin/src/main/kotlin/org') 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 82e2148f..92560c94 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 @@ -3,8 +3,6 @@ package org.jetbrains.dokka.gradle import org.gradle.api.internal.tasks.TaskDependencyInternal import org.gradle.api.provider.Property import org.gradle.api.tasks.* -import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaConfigurationImpl import org.jetbrains.dokka.DokkaModuleDescriptionImpl import org.jetbrains.dokka.DokkaMultimoduleBootstrapImpl @@ -14,25 +12,14 @@ import java.io.File @Deprecated("Use 'DokkaMultimoduleTask' instead", ReplaceWith("DokkaMultimoduleTask")) typealias DokkaMultimoduleTask = DokkaMultiModuleTask +private typealias TaskPath = String abstract class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBootstrapImpl::class) { - /** - * Name of the file containing all necessary module information. - * This file has to be placed inside the subproject root directory. - */ - @Internal - val documentationFileName: Property = project.objects.safeProperty() - .safeConvention("README.md") - @Internal val fileLayout: Property = project.objects.safeProperty() .safeConvention(DokkaMultiModuleFileLayout.CompactInParent) - @get:InputFiles - internal val childDocumentationFiles: Iterable - get() = childDokkaTasks.map { task -> task.project.projectDir.resolve(documentationFileName.getSafe()) } - @get:InputFiles internal val sourceChildOutputDirectories: Iterable get() = childDokkaTasks.map { task -> task.outputDirectory.getSafe() } @@ -41,6 +28,12 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBo internal val targetChildOutputDirectories: Iterable get() = childDokkaTasks.map { task -> targetChildOutputDirectory(task) } + @get:Input + internal val childDokkaTaskIncludes: Map> + get() = childDokkaTasks.filterIsInstance().associate { task -> + task.path to task.dokkaSourceSets.flatMap { it.includes }.toSet() + } + @Internal override fun getTaskDependencies(): TaskDependencyInternal = super.getTaskDependencies() + childDokkaTasks @@ -62,9 +55,9 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBo pluginsClasspath = plugins.resolve().toList(), modules = childDokkaTasks.map { dokkaTask -> DokkaModuleDescriptionImpl( - name = dokkaTask.project.name, - path = targetChildOutputDirectory(dokkaTask).relativeTo(outputDirectory.getSafe()), - docFile = dokkaTask.project.projectDir.resolve(documentationFileName.get()).absoluteFile + name = dokkaTask.moduleName.getSafe(), + relativePathToOutputDirectory = targetChildOutputDirectory(dokkaTask).relativeTo(outputDirectory.getSafe()), + includes = childDokkaTaskIncludes[dokkaTask.path].orEmpty() ) } ) -- cgit