Updated to build plugin 0.1.6

This commit is contained in:
Alexander Nozik 2019-09-02 19:08:28 +03:00
parent 62916d0c67
commit 7045f34c2c
4 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
plugins { plugins {
id("scientifik.mpp") version "0.1.4" apply false id("scientifik.mpp") version "0.1.6" apply false
id("scientifik.publish") version "0.1.4" apply false id("scientifik.publish") version "0.1.6" apply false
} }
val dataforgeVersion by extra("0.1.4-dev-1") val dataforgeVersion by extra("0.1.4-dev-1")

View File

@ -54,7 +54,7 @@ fun Value.toJson(descriptor: ValueDescriptor? = null): JsonElement {
} }
} }
//Use theese methods to customize JSON key mapping //Use these methods to customize JSON key mapping
private fun NameToken.toJsonKey(descriptor: ItemDescriptor?) = toString() private fun NameToken.toJsonKey(descriptor: ItemDescriptor?) = toString()
private fun NodeDescriptor?.getDescriptor(key: String) = this?.items?.get(key) private fun NodeDescriptor?.getDescriptor(key: String) = this?.items?.get(key)

View File

@ -24,7 +24,17 @@ object NameSerializer : KSerializer<Name> {
} }
@Serializer(NameToken::class) @Serializer(NameToken::class)
object NameTokenSerializer: KSerializer<NameToken> object NameTokenSerializer : KSerializer<NameToken> {
override val descriptor: SerialDescriptor = StringDescriptor.withName("NameToken")
override fun deserialize(decoder: Decoder): NameToken {
return decoder.decodeString().toName().first()!!
}
override fun serialize(encoder: Encoder, obj: NameToken) {
encoder.encodeString(obj.toString())
}
}
/** /**
* Serialized for meta * Serialized for meta

View File

@ -20,7 +20,7 @@ class SimpleWorkspace(
) : Workspace { ) : Workspace {
override val tasks: Map<Name, Task<*>> by lazy { override val tasks: Map<Name, Task<*>> by lazy {
context.content<Task<*>>(Task.TYPE) + tasks.associate { it.name.toName() to it } context.content<Task<*>>(Task.TYPE) + tasks.associateBy { it.name.toName() }
} }
companion object { companion object {