From 14de244c02dd05711e3c8690ff5a848938888295 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 17 Mar 2020 11:36:17 +0300 Subject: [PATCH] Move to new kotlin and plugin --- dataforge-vis-common/build.gradle.kts | 1 + .../hep/dataforge/vis/spatial/gdml/GDMLVisualTest.kt | 4 +++- .../hep/dataforge/vis/spatial/gdml/demo/readFile.kt | 4 ++-- demo/muon-monitor/build.gradle.kts | 12 ++---------- .../ru/mipt/npm/muon/monitor/server/MMServer.kt | 4 ++-- .../hep/dataforge/vis/spatial/demo/VariableBox.kt | 7 ++++--- settings.gradle.kts | 2 -- 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/dataforge-vis-common/build.gradle.kts b/dataforge-vis-common/build.gradle.kts index 1774b6ed..f673dde2 100644 --- a/dataforge-vis-common/build.gradle.kts +++ b/dataforge-vis-common/build.gradle.kts @@ -33,6 +33,7 @@ kotlin { dependencies { api("hep.dataforge:dataforge-output-html:$dataforgeVersion") //api(npm("bootstrap","4.4.1")) + implementation(npm("uri-js","4.2.2")) implementation(npm("jsoneditor","8.6.1")) implementation(npm("file-saver")) } diff --git a/demo/gdml/src/commonTest/kotlin/hep/dataforge/vis/spatial/gdml/GDMLVisualTest.kt b/demo/gdml/src/commonTest/kotlin/hep/dataforge/vis/spatial/gdml/GDMLVisualTest.kt index bac4481e..cab81846 100644 --- a/demo/gdml/src/commonTest/kotlin/hep/dataforge/vis/spatial/gdml/GDMLVisualTest.kt +++ b/demo/gdml/src/commonTest/kotlin/hep/dataforge/vis/spatial/gdml/GDMLVisualTest.kt @@ -1,7 +1,9 @@ package hep.dataforge.vis.spatial.gdml +import hep.dataforge.meta.scheme.setProperty import hep.dataforge.meta.string import hep.dataforge.names.toName +import hep.dataforge.values.asValue import hep.dataforge.vis.spatial.Material3D import hep.dataforge.vis.spatial.gdml.demo.cubes import kotlin.test.Test @@ -12,7 +14,7 @@ class GDMLVisualTest { fun testPrototypeProperty() { val gdml = cubes() val visual = gdml.toVisual() - visual["composite000.segment0".toName()]?.setProperty(Material3D.MATERIAL_COLOR_KEY, "red") + visual["composite000.segment0".toName()]?.setProperty(Material3D.MATERIAL_COLOR_KEY, "red".asValue()) assertEquals("red", visual["composite000.segment0".toName()]?.getProperty(Material3D.MATERIAL_COLOR_KEY).string) } } \ No newline at end of file diff --git a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/readFile.kt b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/readFile.kt index b93f00c5..c89b1857 100644 --- a/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/readFile.kt +++ b/demo/gdml/src/jvmMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/readFile.kt @@ -1,5 +1,7 @@ package hep.dataforge.vis.spatial.gdml.demo +import hep.dataforge.meta.scheme.setProperty +import hep.dataforge.values.asValue import hep.dataforge.vis.spatial.Material3D import hep.dataforge.vis.spatial.Visual3D import hep.dataforge.vis.spatial.VisualGroup3D @@ -10,8 +12,6 @@ import scientifik.gdml.GDML import java.io.File import java.util.zip.GZIPInputStream import java.util.zip.ZipInputStream -import hep.dataforge.meta.* -import hep.dataforge.values.* fun Visual3D.Companion.readFile(file: File): VisualGroup3D = when { file.extension == "gdml" || file.extension == "xml" -> { diff --git a/demo/muon-monitor/build.gradle.kts b/demo/muon-monitor/build.gradle.kts index d2d746f9..b1f3126b 100644 --- a/demo/muon-monitor/build.gradle.kts +++ b/demo/muon-monitor/build.gradle.kts @@ -7,19 +7,11 @@ plugins { group = "ru.mipt.npm" -val ktor_version = "1.3.0-rc" +val ktor_version = "1.3.2" kotlin { - js { - browser { - webpackTask { - sourceMaps = true - } - } - } - - val installJS = tasks.getByName("jsBrowserWebpack") + val installJS = tasks.getByName("jsBrowserDistribution") jvm { withJava() diff --git a/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt b/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt index f46f68e1..955ff67c 100644 --- a/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt +++ b/demo/muon-monitor/src/jvmMain/kotlin/ru/mipt/npm/muon/monitor/server/MMServer.kt @@ -14,7 +14,7 @@ import io.ktor.http.content.static import io.ktor.response.respond import io.ktor.routing.Routing import io.ktor.routing.get -import io.ktor.serialization.serialization +import io.ktor.serialization.json import io.ktor.server.cio.CIO import io.ktor.server.engine.embeddedServer import org.apache.commons.math3.random.JDKRandomGenerator @@ -35,7 +35,7 @@ fun Application.module() { install(DefaultHeaders) install(CallLogging) install(ContentNegotiation) { - serialization(json = Visual3D.json) + json(json = Visual3D.json) } install(Routing) { get("/event") { diff --git a/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vis/spatial/demo/VariableBox.kt b/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vis/spatial/demo/VariableBox.kt index 63e6c975..334721a2 100644 --- a/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vis/spatial/demo/VariableBox.kt +++ b/demo/spatial-showcase/src/jsMain/kotlin/hep/dataforge/vis/spatial/demo/VariableBox.kt @@ -4,11 +4,12 @@ package hep.dataforge.vis.spatial.demo import hep.dataforge.meta.int import hep.dataforge.meta.number +import hep.dataforge.meta.scheme.setProperty import hep.dataforge.names.plus import hep.dataforge.names.startsWith +import hep.dataforge.values.asValue import hep.dataforge.vis.common.getProperty import hep.dataforge.vis.common.set -import hep.dataforge.vis.common.setProperty import hep.dataforge.vis.spatial.* import hep.dataforge.vis.spatial.VisualObject3D.Companion.GEOMETRY_KEY import hep.dataforge.vis.spatial.demo.VariableBoxThreeFactory.Z_SIZE_KEY @@ -25,13 +26,13 @@ import kotlin.reflect.KClass internal var VisualObject3D.variableZSize: Number get() = getProperty(Z_SIZE_KEY, false).number ?: 0f set(value) { - setProperty(Z_SIZE_KEY, value) + setProperty(Z_SIZE_KEY, value.asValue()) } internal var VisualObject3D.value: Int get() = getProperty("value", false).int ?: 0 set(value) { - setProperty("value", value) + setProperty("value", value.asValue()) val size = value.toFloat() / 255f * 20f scaleZ = size z = -size / 2 diff --git a/settings.gradle.kts b/settings.gradle.kts index 7dbf2794..891155fd 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,7 +13,6 @@ pluginManagement { resolutionStrategy { eachPlugin { when (requested.id.id) { - "kotlin-dce-js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}") "scientifik.mpp", "scientifik.publish", "scientifik.jvm", "scientifik.js" -> useModule("scientifik:gradle-tools:${requested.version}") "org.openjfx.javafxplugin" -> useModule("org.openjfx:javafx-plugin:${requested.version}") } @@ -27,7 +26,6 @@ rootProject.name = "dataforge-vis" include( ":dataforge-vis-common", -// ":wrappers", ":dataforge-vis-spatial", ":dataforge-vis-spatial-gdml", ":demo:spatial-showcase",