From 03ea4d233b51cf90b5028586355e0311151b6780 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 12 Aug 2020 14:41:10 +0200 Subject: DokkaMultiModuleTask: Use Property/Provider API --- .../org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt | 4 ++-- .../kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'runners/gradle-plugin/src/main/kotlin/org') diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt index e3b82e7c..9da9352c 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayout.kt @@ -47,7 +47,7 @@ interface DokkaMultiModuleFileLayout { internal fun DokkaMultiModuleTask.targetChildOutputDirectory( child: AbstractDokkaTask ): File { - return fileLayout.targetChildOutputDirectory(this, child) + return fileLayout.get().targetChildOutputDirectory(this, child) } internal fun DokkaMultiModuleTask.copyChildOutputDirectories() { @@ -57,7 +57,7 @@ internal fun DokkaMultiModuleTask.copyChildOutputDirectories() { } internal fun DokkaMultiModuleTask.copyChildOutputDirectory(child: AbstractDokkaTask) { - val targetChildOutputDirectory = project.file(fileLayout.targetChildOutputDirectory(this, child)) + val targetChildOutputDirectory = project.file(fileLayout.get().targetChildOutputDirectory(this, child)) val sourceChildOutputDirectory = child.outputDirectory.getSafe() /* Pointing to the same directory -> No copy necessary */ 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 29e0d76e..f6690c3b 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 @@ -1,6 +1,7 @@ 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.DokkaConfigurationImpl import org.jetbrains.dokka.DokkaModuleDescriptionImpl @@ -19,14 +20,16 @@ open class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBootst * This file has to be placed inside the subproject root directory. */ @Internal - var documentationFileName: String = "README.md" + val documentationFileName: Property = project.objects.safeProperty() + .safeConvention("README.md") @Internal - var fileLayout: DokkaMultiModuleFileLayout = DokkaMultiModuleFileLayout.CompactInParent + var fileLayout: Property = project.objects.safeProperty() + .safeConvention(DokkaMultiModuleFileLayout.CompactInParent) @get:InputFiles internal val childDocumentationFiles: Iterable - get() = childDokkaTasks.map { task -> task.project.projectDir.resolve(documentationFileName) } + get() = childDokkaTasks.map { task -> task.project.projectDir.resolve(documentationFileName.getSafe()) } @get:InputFiles internal val sourceChildOutputDirectories: Iterable @@ -59,7 +62,7 @@ open class DokkaMultiModuleTask : AbstractDokkaParentTask(DokkaMultimoduleBootst DokkaModuleDescriptionImpl( name = dokkaTask.project.name, path = targetChildOutputDirectory(dokkaTask).relativeTo(outputDirectory.getSafe()), - docFile = dokkaTask.project.projectDir.resolve(documentationFileName).absoluteFile + docFile = dokkaTask.project.projectDir.resolve(documentationFileName.get()).absoluteFile ) } ) -- cgit