aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt16
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt36
2 files changed, 27 insertions, 25 deletions
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<SourceLinkDefinitionImpl> {
+
@Input
- val path: Property<String> = project.objects.safeProperty<String>()
- .safeConvention("")
+ val localDirectory: Property<File?> = project.objects.safeProperty()
@Input
- val url: Property<String> = project.objects.safeProperty<String>()
+ val remoteUrl: Property<String> = project.objects.safeProperty<String>()
.safeConvention("")
@Optional
@Input
- val lineSuffix: Property<String?> = project.objects.safeProperty()
+ val remoteLineSuffix: Property<String> = project.objects.safeProperty<String>()
+ .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()
)
}
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt
index 26d02fe0..4ab644e7 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt
@@ -219,39 +219,39 @@ class GradleDokkaSourceSetBuilderTest {
sourceSet.sourceLinks.add(
GradleSourceLinkBuilder(project).apply {
- this.lineSuffix by "ls1"
- this.path by "p1"
- this.url by "u1"
+ this.remoteLineSuffix by "ls1"
+ this.localDirectory by project.file("p1")
+ this.remoteUrl by "u1"
})
sourceSet.sourceLink {
- it.lineSuffix by "ls2"
- it.path by "p2"
- it.url by "u2"
+ it.remoteLineSuffix by "ls2"
+ it.localDirectory by project.file("p2")
+ it.remoteUrl by "u2"
}
sourceSet.sourceLink(project.closureOf<GradleSourceLinkBuilder> {
- this.lineSuffix by "ls3"
- this.path by "p3"
- this.url by "u3"
+ this.remoteLineSuffix by "ls3"
+ this.localDirectory by project.file("p3")
+ this.remoteUrl by "u3"
})
assertEquals(
setOf(
SourceLinkDefinitionImpl(
- lineSuffix = "ls1",
- path = "p1",
- url = "u1"
+ remoteLineSuffix = "ls1",
+ localDirectory = project.file("p1").absolutePath,
+ remoteUrl = "u1"
),
SourceLinkDefinitionImpl(
- lineSuffix = "ls2",
- path = "p2",
- url = "u2"
+ remoteLineSuffix = "ls2",
+ localDirectory = project.file("p2").absolutePath,
+ remoteUrl = "u2"
),
SourceLinkDefinitionImpl(
- lineSuffix = "ls3",
- path = "p3",
- url = "u3"
+ remoteLineSuffix = "ls3",
+ localDirectory = project.file("p3").absolutePath,
+ remoteUrl = "u3"
)
),
sourceSet.build().sourceLinks,