diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-14 16:02:42 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-14 17:51:11 +0200 |
commit | 3f8c99cf04893da8fc3c353cba0133dc54e5febe (patch) | |
tree | 95f5b541ad583f85da5130ca01dbff45ec889e6c /runners | |
parent | f655b97cffd875a33618f4326e0a890d3e73ce24 (diff) | |
download | dokka-3f8c99cf04893da8fc3c353cba0133dc54e5febe.tar.gz dokka-3f8c99cf04893da8fc3c353cba0133dc54e5febe.tar.bz2 dokka-3f8c99cf04893da8fc3c353cba0133dc54e5febe.zip |
Use java.net.URL consistently across Gradle Plugin API surface
Diffstat (limited to 'runners')
3 files changed, 10 insertions, 10 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 89ecb5e7..a271e810 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 @@ -8,6 +8,7 @@ import org.gradle.api.tasks.Optional import org.jetbrains.dokka.DokkaConfigurationBuilder import org.jetbrains.dokka.SourceLinkDefinitionImpl import java.io.File +import java.net.URL class GradleSourceLinkBuilder( @Transient @get:Internal internal val project: Project @@ -17,8 +18,7 @@ class GradleSourceLinkBuilder( val localDirectory: Property<File?> = project.objects.safeProperty() @Input - val remoteUrl: Property<String> = project.objects.safeProperty<String>() - .safeConvention("") + val remoteUrl: Property<URL?> = project.objects.safeProperty<URL>() @Optional @Input @@ -28,7 +28,7 @@ class GradleSourceLinkBuilder( override fun build(): SourceLinkDefinitionImpl { return SourceLinkDefinitionImpl( localDirectory = localDirectory.getSafe()?.absolutePath ?: project.projectDir.absolutePath, - remoteUrl = remoteUrl.getSafe(), + remoteUrl = checkNotNull(remoteUrl.getSafe()) { "missing remoteUrl on source link" }, 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 4ab644e7..e48eb0a4 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 @@ -221,19 +221,19 @@ class GradleDokkaSourceSetBuilderTest { GradleSourceLinkBuilder(project).apply { this.remoteLineSuffix by "ls1" this.localDirectory by project.file("p1") - this.remoteUrl by "u1" + this.remoteUrl by URL("https://u1") }) sourceSet.sourceLink { it.remoteLineSuffix by "ls2" it.localDirectory by project.file("p2") - it.remoteUrl by "u2" + it.remoteUrl by URL("https://u2") } sourceSet.sourceLink(project.closureOf<GradleSourceLinkBuilder> { this.remoteLineSuffix by "ls3" this.localDirectory by project.file("p3") - this.remoteUrl by "u3" + this.remoteUrl by URL("https://u3") }) assertEquals( @@ -241,17 +241,17 @@ class GradleDokkaSourceSetBuilderTest { SourceLinkDefinitionImpl( remoteLineSuffix = "ls1", localDirectory = project.file("p1").absolutePath, - remoteUrl = "u1" + remoteUrl = URL("https://u1") ), SourceLinkDefinitionImpl( remoteLineSuffix = "ls2", localDirectory = project.file("p2").absolutePath, - remoteUrl = "u2" + remoteUrl = URL("https://u2") ), SourceLinkDefinitionImpl( remoteLineSuffix = "ls3", localDirectory = project.file("p3").absolutePath, - remoteUrl = "u3" + remoteUrl = URL("https://u3") ) ), sourceSet.build().sourceLinks, diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 781f7cf2..b95b94c0 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -203,7 +203,7 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc skipEmptyPackages = skipEmptyPackages, skipDeprecated = skipDeprecated, jdkVersion = jdkVersion, - sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) }.toSet(), + sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, URL(it.url), it.lineSuffix) }.toSet(), perPackageOptions = perPackageOptions.map { PackageOptionsImpl( prefix = it.prefix, |