aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-26 16:48:21 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-26 16:48:21 +0300
commit42a6272d9806b2b157e174326820bf5e7146a76f (patch)
tree309ebe133fd9a2b111f161e9ab36663ce75ab5a0
parentef9944226db62242ae0645d7d066e4985ddba6cf (diff)
downloaddokka-42a6272d9806b2b157e174326820bf5e7146a76f.tar.gz
dokka-42a6272d9806b2b157e174326820bf5e7146a76f.tar.bz2
dokka-42a6272d9806b2b157e174326820bf5e7146a76f.zip
Fix serialization issues with gradle
#KT-18114 fixed
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt24
1 files changed, 19 insertions, 5 deletions
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt b/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
index 61f9376e..f9846a9e 100644
--- a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
+++ b/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt
@@ -1,8 +1,22 @@
package org.jetbrains.dokka
+import ru.yole.jkid.CustomSerializer
+import ru.yole.jkid.ValueSerializer
+import ru.yole.jkid.deserialization.JKidException
+import java.io.Serializable
import java.net.URL
+class UrlSerializer : ValueSerializer<URL?> {
+ override fun fromJsonValue(jsonValue: Any?): URL? {
+ if (jsonValue !is String?)
+ throw JKidException("Expected string representation of URL, got: $jsonValue")
+ return jsonValue?.let { URL(jsonValue) }
+ }
+
+ override fun toJsonValue(value: URL?): Any? = value?.toExternalForm()
+}
+
interface DokkaConfiguration {
val moduleName: String
val classpath: List<String>
@@ -43,13 +57,13 @@ interface DokkaConfiguration {
}
interface ExternalDocumentationLink {
- val url: URL
- val packageListUrl: URL
+ @CustomSerializer(UrlSerializer::class) val url: URL
+ @CustomSerializer(UrlSerializer::class) val packageListUrl: URL
open class Builder(open var url: URL? = null,
open var packageListUrl: URL? = null) {
- constructor(root: String) : this(URL(root), null)
+ constructor(root: String, packageList: String? = null) : this(URL(root), packageList?.let { URL(it) })
fun build(): DokkaConfiguration.ExternalDocumentationLink =
if (packageListUrl != null && url != null)
@@ -83,5 +97,5 @@ data class SerializeOnlyDokkaConfiguration(override val moduleName: String,
override val noStdlibLink: Boolean) : DokkaConfiguration
-data class ExternalDocumentationLinkImpl internal constructor(override val url: URL,
- override val packageListUrl: URL) : DokkaConfiguration.ExternalDocumentationLink \ No newline at end of file
+data class ExternalDocumentationLinkImpl(@CustomSerializer(UrlSerializer::class) override val url: URL,
+ @CustomSerializer(UrlSerializer::class) override val packageListUrl: URL) : Serializable, DokkaConfiguration.ExternalDocumentationLink \ No newline at end of file