Verified Commit bfd19009 authored by Konstantin Kopper's avatar Konstantin Kopper
Browse files

Kotlin 1.3.61 and some dependency upgrades

parent 9dfeb3b7
Pipeline #14577 passed with stages
in 5 minutes and 5 seconds
......@@ -7,8 +7,8 @@ if (!JavaVersion.current().isJava8Compatible)
error("Only JDK 8 or newer is supported!")
plugins {
kotlin("jvm") version "1.3.60"
kotlin("plugin.serialization") version "1.3.60"
kotlin("jvm") version "1.3.61"
kotlin("plugin.serialization") version "1.3.61"
id("org.jetbrains.dokka") version "0.9.18"
}
......@@ -16,9 +16,9 @@ repositories {
jcenter()
}
val ktorVersion = "1.2.5"
val ktorVersion = "1.2.6"
val junitVersion = "5.5.2"
val aspectjVersion = "1.9.4"
val aspectjVersion = "1.9.5"
dependencies {
// The pseuco-java-compiler
......@@ -31,7 +31,7 @@ dependencies {
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.3.2")
// Kotlin serialization
implementation("org.jetbrains.kotlinx", "kotlinx-serialization-runtime", "0.13.0")
implementation("org.jetbrains.kotlinx", "kotlinx-serialization-runtime", "0.14.0")
// OpenJFX
if (JavaVersion.current().isJava11Compatible) {
......@@ -41,7 +41,7 @@ dependencies {
}
// Provides RichText TextAreas. Used for code input area.
implementation("org.fxmisc.richtext", "richtextfx", "0.10.2")
implementation("org.fxmisc.richtext", "richtextfx", "0.10.3")
// Google GSON library for JSON
implementation("com.google.code.gson", "gson", "2.8.6")
......@@ -58,7 +58,7 @@ dependencies {
implementation("io.ktor", "ktor-freemarker", ktorVersion)
// http4k WebSocket client library
implementation("org.http4k", "http4k-client-websocket", "3.196.0")
implementation("org.http4k", "http4k-client-websocket", "3.200.0")
// AspectJ runtime
runtimeOnly("org.aspectj", "aspectjrt", aspectjVersion)
......@@ -70,7 +70,7 @@ dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter-params", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
testImplementation("org.mockito", "mockito-junit-jupiter", "3.1.0")
testImplementation("org.mockito", "mockito-junit-jupiter", "3.2.0")
}
version = "2.0.3"
......@@ -296,7 +296,7 @@ val dokka by tasks.getting(DokkaTask::class) {
}
externalDocumentationLink {
url = url("https://api.ktor.io/1.2.4/") // TODO replace by ktorVersion
url = url("https://api.ktor.io/$ktorVersion/")
}
linkMapping {
......
package com.pseuco
import kotlinx.serialization.Decoder
import kotlinx.serialization.Encoder
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Required
import kotlinx.serialization.SerialDescriptor
import kotlinx.serialization.Serializable
import kotlinx.serialization.internal.CommonEnumSerializer
import kotlinx.serialization.UnionKind
/**
* Class representing sharable pseuCo.com files.
......@@ -43,7 +47,19 @@ data class PseuCoComFile(val name: String, val content: String, @Required val ty
* @author Konstantin Kopper
* @since 2.0.4
*/
companion object : CommonEnumSerializer<Type>("PseuCoComFile.Type", values(),
values().map { it.name.toLowerCase() }.toTypedArray())
companion object : KSerializer<Type> {
override val descriptor = object : SerialDescriptor {
override val name = "PseuCoComFile.Type"
override val kind = UnionKind.ENUM_KIND
override val elementsCount = values().size
override fun getElementDescriptor(index: Int): SerialDescriptor = this
override fun getElementIndex(name: String): Int = valueOf(name.toUpperCase()).ordinal
override fun getElementName(index: Int): String = values()[index].name.toLowerCase()
}
override fun deserialize(decoder: Decoder): Type = values()[descriptor.getElementIndex(decoder.decodeString())]
override fun serialize(encoder: Encoder, obj: Type) = encoder.encodeString(descriptor.getElementName(obj.ordinal))
}
}
}
......@@ -6,9 +6,10 @@ import kotlinx.serialization.Decoder
import kotlinx.serialization.Encoder
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialDescriptor
import kotlinx.serialization.SerialKind
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.internal.CommonEnumSerializer
import kotlinx.serialization.UnionKind
import kotlinx.serialization.internal.SerialClassDescImpl
/**
......@@ -126,8 +127,23 @@ sealed class SocketMessage(val type: String) {
* @author Konstantin Kopper
* @since 2.0.4
*/
companion object : CommonEnumSerializer<Code>("SocketMessage.Response.Error.Code", values(),
values().map { it.name.toLowerCase().replace(Regex("_(\\w)")) { match -> match.groupValues[1].toUpperCase() } }.toTypedArray())
companion object : KSerializer<Code> {
private val stringValues = values().map {
it.name.toLowerCase().replace(Regex("_(\\w)")) { match -> match.groupValues[1].toUpperCase() }
}
override val descriptor = object : SerialDescriptor {
override val name: String = "SocketMessage.Response.Error.Code"
override val kind: SerialKind = UnionKind.ENUM_KIND
override val elementsCount: Int = values().size
override fun getElementIndex(name: String): Int = valueOf(name).ordinal
override fun getElementName(index: Int): String = values()[index].name
}
override fun deserialize(decoder: Decoder): Code = values()[stringValues.indexOf(decoder.decodeString())]
override fun serialize(encoder: Encoder, obj: Code) = encoder.encodeString(stringValues[obj.ordinal])
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment