From c499c3fc474936e3b870d5d4173de1d8be7923a4 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 31 Jan 2024 16:45:43 +0300 Subject: [PATCH] wip Kotlin 2.0 --- .gitignore | 1 + gradle.properties | 2 +- .../space/kscience/visionforge/gdml/gdmlLoader.kt | 2 +- .../kscience/visionforge/markup/MarkupPlugin.kt | 8 ++++---- .../kscience/visionforge/markup/MarkupPlugin.kt | 8 ++++---- .../kscience/visionforge/plotly/PlotlyPlugin.kt | 13 ++++++++++++- .../space/kscience/visionforge/plotly/plotlyJs.kt | 8 ++++---- .../space/kscience/visionforge/plotly/plotlyJvm.kt | 8 ++++---- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 6d07da58..4dc36cae 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ out/ .gradle build/ data/ +.kotlin/ !gradle-wrapper.jar diff --git a/gradle.properties b/gradle.properties index 7feaacca..e7b89633 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ org.gradle.jvmargs=-Xmx4G org.jetbrains.compose.experimental.jscanvas.enabled=true -toolsVersion=0.15.2-kotlin-2.0.0-Beta2 +toolsVersion=0.15.2-kotlin-2.0.0-Beta3 #kotlin.experimental.tryK2=true #kscience.wasm.disabled=true diff --git a/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/gdmlLoader.kt b/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/gdmlLoader.kt index 0c81d258..8c1d9407 100644 --- a/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/gdmlLoader.kt +++ b/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/gdmlLoader.kt @@ -373,7 +373,7 @@ private class GdmlLoader(val settings: GdmlLoaderOptions) { rootSolid.prototypes { templates.items.forEach { (token, item) -> item.parent = null - setChild(token.asName(), item as? Solid) + setChild(token.asName(), item) } } settings.styleCache.forEach { diff --git a/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt b/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt index ef700466..06470e4b 100644 --- a/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt +++ b/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt @@ -19,8 +19,8 @@ import space.kscience.visionforge.markup.VisionOfMarkup.Companion.GFM_FORMAT public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer { public val visionClient: JsVisionClient by require(JsVisionClient) - override val tag: PluginTag get() = Companion.tag - override val visionSerializersModule: SerializersModule get() = markupSerializersModule + actual override val tag: PluginTag get() = Companion.tag + actual override val visionSerializersModule: SerializersModule get() = markupSerializersModule override fun rateVision(vision: Vision): Int = when (vision) { is VisionOfMarkup -> ElementVisionRenderer.DEFAULT_RATING @@ -51,9 +51,9 @@ public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer { } public actual companion object : PluginFactory { - override val tag: PluginTag = PluginTag("vision.markup.js", PluginTag.DATAFORGE_GROUP) + actual override val tag: PluginTag = PluginTag("vision.markup.js", PluginTag.DATAFORGE_GROUP) - override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() + actual override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() } } \ No newline at end of file diff --git a/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt b/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt index ce094ee9..1b0a9cc4 100644 --- a/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt +++ b/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt @@ -9,14 +9,14 @@ import space.kscience.dataforge.meta.Meta import space.kscience.visionforge.VisionPlugin public actual class MarkupPlugin : VisionPlugin() { - override val visionSerializersModule: SerializersModule get() = markupSerializersModule + actual override val visionSerializersModule: SerializersModule get() = markupSerializersModule - override val tag: PluginTag get() = Companion.tag + actual override val tag: PluginTag get() = Companion.tag public actual companion object : PluginFactory { - override val tag: PluginTag = PluginTag("vision.markup.jvm", PluginTag.DATAFORGE_GROUP) + actual override val tag: PluginTag = PluginTag("vision.markup.jvm", PluginTag.DATAFORGE_GROUP) - override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() + actual override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() } } diff --git a/visionforge-plotly/src/commonMain/kotlin/space/kscience/visionforge/plotly/PlotlyPlugin.kt b/visionforge-plotly/src/commonMain/kotlin/space/kscience/visionforge/plotly/PlotlyPlugin.kt index da6185c6..c33cf9b8 100644 --- a/visionforge-plotly/src/commonMain/kotlin/space/kscience/visionforge/plotly/PlotlyPlugin.kt +++ b/visionforge-plotly/src/commonMain/kotlin/space/kscience/visionforge/plotly/PlotlyPlugin.kt @@ -3,12 +3,23 @@ package space.kscience.visionforge.plotly import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.modules.polymorphic import kotlinx.serialization.modules.subclass +import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.PluginFactory +import space.kscience.dataforge.context.PluginTag +import space.kscience.dataforge.meta.Meta import space.kscience.visionforge.Vision import space.kscience.visionforge.VisionPlugin public expect class PlotlyPlugin : VisionPlugin { - public companion object : PluginFactory + + override val tag: PluginTag + override val visionSerializersModule: SerializersModule + + public companion object : PluginFactory{ + override fun build(context: Context, meta: Meta): PlotlyPlugin + + override val tag: PluginTag + } } internal val plotlySerializersModule = SerializersModule { diff --git a/visionforge-plotly/src/jsMain/kotlin/space/kscience/visionforge/plotly/plotlyJs.kt b/visionforge-plotly/src/jsMain/kotlin/space/kscience/visionforge/plotly/plotlyJs.kt index 074be6dc..d7e5aaf6 100644 --- a/visionforge-plotly/src/jsMain/kotlin/space/kscience/visionforge/plotly/plotlyJs.kt +++ b/visionforge-plotly/src/jsMain/kotlin/space/kscience/visionforge/plotly/plotlyJs.kt @@ -18,9 +18,9 @@ import space.kscience.visionforge.VisionPlugin public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer { public val visionClient: JsVisionClient by require(JsVisionClient) - override val tag: PluginTag get() = Companion.tag + actual override val tag: PluginTag get() = Companion.tag - override val visionSerializersModule: SerializersModule get() = plotlySerializersModule + actual override val visionSerializersModule: SerializersModule get() = plotlySerializersModule override fun rateVision(vision: Vision): Int = when (vision) { is VisionOfPlotly -> ElementVisionRenderer.DEFAULT_RATING @@ -39,9 +39,9 @@ public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer { } public actual companion object : PluginFactory { - override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP) + actual override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP) - override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin() + actual override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin() } } \ No newline at end of file diff --git a/visionforge-plotly/src/jvmMain/kotlin/space/kscience/visionforge/plotly/plotlyJvm.kt b/visionforge-plotly/src/jvmMain/kotlin/space/kscience/visionforge/plotly/plotlyJvm.kt index b9a8d373..40c0e1ba 100644 --- a/visionforge-plotly/src/jvmMain/kotlin/space/kscience/visionforge/plotly/plotlyJvm.kt +++ b/visionforge-plotly/src/jvmMain/kotlin/space/kscience/visionforge/plotly/plotlyJvm.kt @@ -9,14 +9,14 @@ import space.kscience.visionforge.VisionPlugin public actual class PlotlyPlugin : VisionPlugin() { - override val tag: PluginTag get() = Companion.tag + actual override val tag: PluginTag get() = Companion.tag - override val visionSerializersModule: SerializersModule get() = plotlySerializersModule + actual override val visionSerializersModule: SerializersModule get() = plotlySerializersModule public actual companion object : PluginFactory { - override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP) + actual override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP) - override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin() + actual override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin() } } \ No newline at end of file