Some serialization fixes
This commit is contained in:
parent
aefee64581
commit
f63a2b6e93
@ -1,10 +1,12 @@
|
|||||||
|
import scientifik.ScientifikExtension
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("scientifik.mpp") version "0.2.1" apply false
|
id("scientifik.mpp") version "0.2.2" apply false
|
||||||
id("scientifik.jvm") version "0.2.1" apply false
|
id("scientifik.jvm") version "0.2.2" apply false
|
||||||
id("scientifik.publish") version "0.2.1" apply false
|
id("scientifik.publish") version "0.2.2" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion by extra("0.1.4")
|
val dataforgeVersion by extra("0.1.5-dev-1")
|
||||||
|
|
||||||
val bintrayRepo by extra("dataforge")
|
val bintrayRepo by extra("dataforge")
|
||||||
val githubProject by extra("dataforge-core")
|
val githubProject by extra("dataforge-core")
|
||||||
@ -15,7 +17,8 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
if (name.startsWith("dataforge")) {
|
apply(plugin = "scientifik.publish")
|
||||||
apply(plugin = "scientifik.publish")
|
afterEvaluate {
|
||||||
}
|
extensions.findByType<ScientifikExtension>()?.apply { withDokka() }
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package hep.dataforge.context
|
package hep.dataforge.context
|
||||||
|
|
||||||
|
import hep.dataforge.meta.DFBuilder
|
||||||
import hep.dataforge.meta.MetaBuilder
|
import hep.dataforge.meta.MetaBuilder
|
||||||
import hep.dataforge.meta.buildMeta
|
import hep.dataforge.meta.buildMeta
|
||||||
import hep.dataforge.names.toName
|
import hep.dataforge.names.toName
|
||||||
@ -7,6 +8,7 @@ import hep.dataforge.names.toName
|
|||||||
/**
|
/**
|
||||||
* A convenience builder for context
|
* A convenience builder for context
|
||||||
*/
|
*/
|
||||||
|
@DFBuilder
|
||||||
class ContextBuilder(var name: String = "@anonymous", val parent: Context = Global) {
|
class ContextBuilder(var name: String = "@anonymous", val parent: Context = Global) {
|
||||||
private val plugins = ArrayList<Plugin>()
|
private val plugins = ArrayList<Plugin>()
|
||||||
private var meta = MetaBuilder()
|
private var meta = MetaBuilder()
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package hep.dataforge.data
|
package hep.dataforge.data
|
||||||
|
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.*
|
||||||
import hep.dataforge.meta.MetaBuilder
|
|
||||||
import hep.dataforge.meta.builder
|
|
||||||
import hep.dataforge.meta.seal
|
|
||||||
import hep.dataforge.names.Name
|
import hep.dataforge.names.Name
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@ -20,6 +17,7 @@ data class ActionEnv(
|
|||||||
/**
|
/**
|
||||||
* Action environment
|
* Action environment
|
||||||
*/
|
*/
|
||||||
|
@DFBuilder
|
||||||
class MapActionBuilder<T, R>(var name: Name, var meta: MetaBuilder, val actionMeta: Meta) {
|
class MapActionBuilder<T, R>(var name: Name, var meta: MetaBuilder, val actionMeta: Meta) {
|
||||||
lateinit var result: suspend ActionEnv.(T) -> R
|
lateinit var result: suspend ActionEnv.(T) -> R
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package hep.dataforge.io.serialization
|
package hep.dataforge.io.serialization
|
||||||
|
|
||||||
import kotlinx.serialization.CompositeDecoder
|
import hep.dataforge.meta.DFExperimental
|
||||||
import kotlinx.serialization.Decoder
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.KSerializer
|
|
||||||
import kotlinx.serialization.SerialDescriptor
|
|
||||||
import kotlinx.serialization.internal.*
|
import kotlinx.serialization.internal.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,10 +69,24 @@ inline fun <reified T : Any> KSerializer<T>.descriptor(
|
|||||||
): SerialDescriptor =
|
): SerialDescriptor =
|
||||||
SerialDescriptorBuilder(SerialClassDescImpl(name)).apply(block).build()
|
SerialDescriptorBuilder(SerialClassDescImpl(name)).apply(block).build()
|
||||||
|
|
||||||
fun Decoder.decodeStructure(
|
@DFExperimental
|
||||||
|
inline fun <R> Decoder.decodeStructure(
|
||||||
desc: SerialDescriptor,
|
desc: SerialDescriptor,
|
||||||
vararg typeParams: KSerializer<*> = emptyArray(),
|
vararg typeParams: KSerializer<*> = emptyArray(),
|
||||||
block: CompositeDecoder.() -> Unit
|
crossinline block: CompositeDecoder.() -> R
|
||||||
|
): R {
|
||||||
|
val decoder = beginStructure(desc, *typeParams)
|
||||||
|
val res = decoder.block()
|
||||||
|
decoder.endStructure(desc)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun Encoder.encodeStructure(
|
||||||
|
desc: SerialDescriptor,
|
||||||
|
vararg typeParams: KSerializer<*> = emptyArray(),
|
||||||
|
block: CompositeEncoder.() -> Unit
|
||||||
) {
|
) {
|
||||||
beginStructure(desc, *typeParams).apply(block).endStructure(desc)
|
val encoder = beginStructure(desc, *typeParams)
|
||||||
|
encoder.block()
|
||||||
|
encoder.endStructure(desc)
|
||||||
}
|
}
|
@ -47,7 +47,7 @@ class HtmlOutput<T : Any>(override val context: Context, private val consumer: T
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A text or binary renderer based on [kotlinx.io.core.Output]
|
* A text or binary renderer based on [Output]
|
||||||
*/
|
*/
|
||||||
@Type(HTML_CONVERTER_TYPE)
|
@Type(HTML_CONVERTER_TYPE)
|
||||||
interface HtmlBuilder<T : Any> {
|
interface HtmlBuilder<T : Any> {
|
||||||
|
@ -3,6 +3,7 @@ package hep.dataforge.workspace
|
|||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.data.*
|
import hep.dataforge.data.*
|
||||||
import hep.dataforge.descriptors.NodeDescriptor
|
import hep.dataforge.descriptors.NodeDescriptor
|
||||||
|
import hep.dataforge.meta.DFBuilder
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.meta.get
|
import hep.dataforge.meta.get
|
||||||
import hep.dataforge.meta.string
|
import hep.dataforge.meta.string
|
||||||
@ -13,7 +14,7 @@ import hep.dataforge.names.toName
|
|||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@TaskBuildScope
|
@DFBuilder
|
||||||
class TaskBuilder<R : Any>(val name: Name, val type: KClass<out R>) {
|
class TaskBuilder<R : Any>(val name: Name, val type: KClass<out R>) {
|
||||||
private var modelTransform: TaskModelBuilder.(Meta) -> Unit = { allData() }
|
private var modelTransform: TaskModelBuilder.(Meta) -> Unit = { allData() }
|
||||||
// private val additionalDependencies = HashSet<Dependency>()
|
// private val additionalDependencies = HashSet<Dependency>()
|
||||||
|
@ -58,9 +58,6 @@ fun TaskModel.buildInput(workspace: Workspace): DataTree<Any> {
|
|||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@DslMarker
|
|
||||||
annotation class TaskBuildScope
|
|
||||||
|
|
||||||
interface TaskDependencyContainer {
|
interface TaskDependencyContainer {
|
||||||
val defaultMeta: Meta
|
val defaultMeta: Meta
|
||||||
fun add(dependency: Dependency)
|
fun add(dependency: Dependency)
|
||||||
|
Loading…
Reference in New Issue
Block a user