From 334619d42d3c26379429ea8cdab13b28c87c159e Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 11 Aug 2020 14:10:37 +0200 Subject: Refine and test `GradleSourceLinkBuilder` and SourceLinkDefinition API --- .../jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'runners/gradle-plugin/src/main') diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt index 54700fe9..89ecb5e7 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt @@ -7,27 +7,29 @@ import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Optional import org.jetbrains.dokka.DokkaConfigurationBuilder import org.jetbrains.dokka.SourceLinkDefinitionImpl +import java.io.File class GradleSourceLinkBuilder( @Transient @get:Internal internal val project: Project ) : DokkaConfigurationBuilder { + @Input - val path: Property = project.objects.safeProperty() - .safeConvention("") + val localDirectory: Property = project.objects.safeProperty() @Input - val url: Property = project.objects.safeProperty() + val remoteUrl: Property = project.objects.safeProperty() .safeConvention("") @Optional @Input - val lineSuffix: Property = project.objects.safeProperty() + val remoteLineSuffix: Property = project.objects.safeProperty() + .safeConvention("#L") override fun build(): SourceLinkDefinitionImpl { return SourceLinkDefinitionImpl( - path = path.getSafe(), - url = url.getSafe(), - lineSuffix = lineSuffix.getSafe() + localDirectory = localDirectory.getSafe()?.absolutePath ?: project.projectDir.absolutePath, + remoteUrl = remoteUrl.getSafe(), + remoteLineSuffix = remoteLineSuffix.getSafe() ) } } -- cgit