aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/jarRepositories.xml5
-rw-r--r--core/src/main/kotlin/utilities/json.kt26
-rw-r--r--core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt11
3 files changed, 27 insertions, 15 deletions
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 0c589859..22445433 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -101,5 +101,10 @@
<option name="name" value="MavenLocal" />
<option name="url" value="file:$MAVEN_REPOSITORY$" />
</remote-repository>
+ <remote-repository>
+ <option name="id" value="maven" />
+ <option name="name" value="maven" />
+ <option name="url" value="https://dl.bintray.com/kotlin/kotlin-eap/" />
+ </remote-repository>
</component>
</project> \ No newline at end of file
diff --git a/core/src/main/kotlin/utilities/json.kt b/core/src/main/kotlin/utilities/json.kt
index d2e70d75..2096879a 100644
--- a/core/src/main/kotlin/utilities/json.kt
+++ b/core/src/main/kotlin/utilities/json.kt
@@ -1,19 +1,26 @@
package org.jetbrains.dokka.utilities
import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.databind.*
-import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper
+import com.fasterxml.jackson.core.JsonParser
+import com.fasterxml.jackson.databind.DeserializationContext
+import com.fasterxml.jackson.databind.DeserializationFeature
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer
import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
+import org.jetbrains.dokka.SourceRootImpl
import java.io.File
-import java.lang.reflect.Type
import com.fasterxml.jackson.core.type.TypeReference as JacksonTypeReference
private val objectMapper = run {
val module = SimpleModule().apply {
addSerializer(FileSerializer)
+ addSerializer(SourceRoot::class.java, SourceRootSerializer)
+ addDeserializer(SourceRootImpl::class.java, SourceRootImplDeserializer)
+ addDeserializer(SourceRoot::class.java, SourceRootImplDeserializer)
}
jacksonObjectMapper()
.registerModule(module)
@@ -47,13 +54,16 @@ private object FileSerializer : StdScalarSerializer<File>(File::class.java) {
override fun serialize(value: File, g: JsonGenerator, provider: SerializerProvider) {
g.writeString(value.path)
}
+}
- override fun getSchema(provider: SerializerProvider, typeHint: Type): JsonNode {
- return createSchemaNode("string", true)
+private object SourceRootSerializer : StdScalarSerializer<SourceRoot>(SourceRoot::class.java) {
+ override fun serialize(value: SourceRoot, g: JsonGenerator, provider: SerializerProvider) {
+ g.writeString(value.path)
}
+}
- @Throws(JsonMappingException::class)
- override fun acceptJsonFormatVisitor(visitor: JsonFormatVisitorWrapper, typeHint: JavaType) {
- visitStringFormat(visitor, typeHint)
+private object SourceRootImplDeserializer : StdScalarDeserializer<SourceRootImpl>(SourceRootImpl::class.java) {
+ override fun deserialize(p: JsonParser, ctxt: DeserializationContext): SourceRootImpl {
+ return SourceRootImpl(p.text)
}
}
diff --git a/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt b/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt
index d0cb55a1..e954c82c 100644
--- a/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt
+++ b/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt
@@ -38,12 +38,8 @@ class DokkaConfigurationJsonTest {
"moduleName": "customModuleName",
"sourceSetName": "customSourceSetName"
},
- "classpath": [],
- "sourceRoots": [
- {
- "path": "customSourceRoot"
- }
- ]
+ "sourceRoots": [ "customSourceRoot" ],
+ "classpath": [ "classpath/custom1.jar", "classpath/custom2.jar" ]
}
]
}
@@ -58,7 +54,8 @@ class DokkaConfigurationJsonTest {
DokkaSourceSetImpl(
moduleDisplayName = "customModuleDisplayName",
sourceRoots = listOf(SourceRootImpl("customSourceRoot")),
- sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName")
+ sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName"),
+ classpath = listOf("classpath/custom1.jar", "classpath/custom2.jar")
)
)
),