diff options
4 files changed, 15 insertions, 12 deletions
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<String> = project.objects.safeProperty<String>() + .safeConvention("README.md") @Internal - var fileLayout: DokkaMultiModuleFileLayout = DokkaMultiModuleFileLayout.CompactInParent + var 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) } + get() = childDokkaTasks.map { task -> task.project.projectDir.resolve(documentationFileName.getSafe()) } @get:InputFiles internal val sourceChildOutputDirectories: Iterable<File> @@ -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 ) } ) diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt index 6ec3dd57..407b1ef9 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt @@ -57,7 +57,7 @@ class DokkaMultiModuleFileLayoutTest { subFolder.mkdirs() subFolder.resolve("other.file").writeText("other text") - parentTask.fileLayout = object : DokkaMultiModuleFileLayout { + parentTask.fileLayout by object : DokkaMultiModuleFileLayout { override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File { return parent.project.file("target/output") } @@ -105,7 +105,7 @@ class DokkaMultiModuleFileLayoutTest { val project = ProjectBuilder.builder().build() val childTask = project.tasks.create<DokkaTask>("child") val parentTask = project.tasks.create<DokkaMultiModuleTask>("parent") - parentTask.fileLayout = object : DokkaMultiModuleFileLayout { + parentTask.fileLayout by object : DokkaMultiModuleFileLayout { override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File { return child.outputDirectory.getSafe().resolve("subfolder") } @@ -118,7 +118,7 @@ class DokkaMultiModuleFileLayoutTest { val project = ProjectBuilder.builder().build() val childTask = project.tasks.create<DokkaTask>("child") val parentTask = project.tasks.create<DokkaMultiModuleTask>("parent") - parentTask.fileLayout = NoCopy + parentTask.fileLayout by NoCopy parentTask.copyChildOutputDirectory(childTask) } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt index 640d980b..1e444d80 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt @@ -58,7 +58,7 @@ class DokkaMultiModuleTaskTest { assertTrue(multimoduleTasks.isNotEmpty(), "Expected at least one multimodule task") multimoduleTasks.configureEach { task -> - task.documentationFileName = "customDocumentationFileName.md" + task.documentationFileName by "customDocumentationFileName.md" task.outputDirectory by task.project.buildDir.resolve("customOutputDirectory") task.cacheRoot by File("customCacheRoot") task.pluginsConfiguration.put("pluginA", "configA") @@ -131,7 +131,7 @@ class DokkaMultiModuleTaskTest { val childTask = child.tasks.create<DokkaTask>("child") parentTask.addChildTask(childTask) - parentTask.documentationFileName = "module.txt" + parentTask.documentationFileName by "module.txt" assertEquals( listOf(parent.file("child/module.txt")), parentTask.childDocumentationFiles, @@ -165,7 +165,7 @@ class DokkaMultiModuleTaskTest { val childTask = child.tasks.create<DokkaTask>("child") parentTask.addChildTask(childTask) - parentTask.fileLayout = object : DokkaMultiModuleFileLayout { + parentTask.fileLayout by object : DokkaMultiModuleFileLayout { override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File { return parent.project.buildDir.resolve(child.name) } |