diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-28 11:28:54 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-31 15:10:04 +0200 |
commit | 02ccae10e3f717c330dae5d87b49a0e72f798905 (patch) | |
tree | 4c63d6039fdc5a20c065724e672adbc5c6a3a0e5 /runners/gradle-plugin/src/main | |
parent | 8cd28416817dfd7d28bb66b28e849d97cc09012b (diff) | |
download | dokka-02ccae10e3f717c330dae5d87b49a0e72f798905.tar.gz dokka-02ccae10e3f717c330dae5d87b49a0e72f798905.tar.bz2 dokka-02ccae10e3f717c330dae5d87b49a0e72f798905.zip |
Re-use includes form child tasks for all modules page generation
Diffstat (limited to 'runners/gradle-plugin/src/main')
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt | 27 |
1 files changed, 10 insertions, 17 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 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,26 +12,15 @@ 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<String> = project.objects.safeProperty<String>() - .safeConvention("README.md") - @Internal val fileLayout: Property<DokkaMultiModuleFileLayout> = project.objects.safeProperty<DokkaMultiModuleFileLayout>() .safeConvention(DokkaMultiModuleFileLayout.CompactInParent) @get:InputFiles - internal val childDocumentationFiles: Iterable<File> - get() = childDokkaTasks.map { task -> task.project.projectDir.resolve(documentationFileName.getSafe()) } - - @get:InputFiles internal val sourceChildOutputDirectories: Iterable<File> get() = childDokkaTasks.map { task -> task.outputDirectory.getSafe() } @@ -41,6 +28,12 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBo internal val targetChildOutputDirectories: Iterable<File> get() = childDokkaTasks.map { task -> targetChildOutputDirectory(task) } + @get:Input + internal val childDokkaTaskIncludes: Map<TaskPath, Set<File>> + get() = childDokkaTasks.filterIsInstance<DokkaTask>().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() ) } ) |