Update kotlin and DF

This commit is contained in:
Alexander Nozik 2021-11-24 12:28:41 +03:00
parent b40c1d0025
commit 6787ec85de
11 changed files with 21 additions and 18 deletions

View File

@ -39,5 +39,8 @@ apiValidation {
//workaround for https://youtrack.jetbrains.com/issue/KT-48273
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class.java) {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().versions.webpackDevServer.version = "4.0.0"
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().versions.apply {
webpack.version = "5.64.3"
webpackDevServer.version = "4.5.0"
}
}

View File

@ -7,7 +7,7 @@ import kotlinx.css.*
import org.w3c.files.File
import org.w3c.files.FileReader
import org.w3c.files.get
import react.RProps
import react.Props
import react.dom.h2
import react.functionComponent
import react.useMemo
@ -27,7 +27,7 @@ import space.kscience.visionforge.solid.Solids
import styled.css
import styled.styledDiv
external interface GDMLAppProps : RProps {
external interface GDMLAppProps : Props {
var context: Context
var vision: Solid?
var selected: Name?

View File

@ -2,9 +2,8 @@ package space.kscience.visionforge.gdml.demo
import kotlinx.browser.document
import kotlinx.css.*
import react.child
import react.dom.render
import space.kscience.dataforge.context.Global
import space.kscience.dataforge.context.Context
import space.kscience.gdml.GdmlShowCase
import space.kscience.visionforge.Application
import space.kscience.visionforge.gdml.toVision
@ -16,7 +15,7 @@ import styled.injectGlobal
private class GDMLDemoApp : Application {
override fun start(state: Map<String, Any>) {
val context = Global.buildContext("gdml-demo"){
val context = Context("gdml-demo"){
plugin(ThreePlugin)
}

View File

@ -2,7 +2,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.css.*
import react.RProps
import react.Props
import react.functionComponent
import space.kscience.dataforge.context.Context
import space.kscience.plotly.layout
@ -16,7 +16,7 @@ import styled.css
import styled.styledDiv
import kotlin.math.sqrt
external interface DemoProps : RProps {
external interface DemoProps : Props {
var context: Context
}

View File

@ -6,7 +6,7 @@ import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
import org.w3c.dom.Element
import org.w3c.dom.HTMLElement
import react.RProps
import react.Props
import react.functionComponent
import react.useEffect
import react.useRef
@ -16,7 +16,7 @@ import space.kscience.visionforge.useProperty
import styled.css
import styled.styledDiv
external interface MarkupProps : RProps {
external interface MarkupProps : Props {
var markup: VisionOfMarkup?
}

View File

@ -9,7 +9,7 @@ import space.kscience.plotly.plot
import styled.css
import styled.styledDiv
external interface PlotlyProps : RProps {
external interface PlotlyProps : Props {
var plot: Plot?
}

View File

@ -7,7 +7,7 @@ import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.launch
import kotlinx.css.*
import kotlinx.html.js.onClickFunction
import react.RProps
import react.Props
import react.dom.attrs
import react.dom.button
import react.dom.p
@ -28,7 +28,7 @@ import styled.styledDiv
import styled.styledSpan
import kotlin.math.PI
external interface MMAppProps : RProps {
external interface MMAppProps : Props {
var model: Model
var context: Context
var connection: HttpClient

View File

@ -67,7 +67,7 @@ internal class SC1Aux(val sc: SC1, var efficiency: Double = 1.0) {
UPPER_LAYER_Z -> 1
CENTRAL_LAYER_Z -> 2;
LOWER_LAYER_Z -> 3;
else -> throw RuntimeException("Unknown layer");
else -> error("Unknown layer");
}
}

View File

@ -78,6 +78,6 @@ class Cos2TrackGenerator(
return makeTrack(x, y, thetaCandidate, phi)
}
}
throw RuntimeException("Failed to generate theta from distribution")
error("Failed to generate theta from distribution")
}
}

View File

@ -52,12 +52,12 @@ public class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) {
while (!FX.initialized.get()) {
if (Thread.interrupted()) {
throw RuntimeException("Interrupted application start")
error("Interrupted application start")
}
}
Platform.setImplicitExit(false)
} else {
throw RuntimeException("FX Application not defined")
error("FX Application not defined")
}
}
}

View File

@ -43,6 +43,7 @@ import java.awt.Desktop
import java.net.URI
import kotlin.collections.set
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
/**
@ -143,7 +144,7 @@ public class VisionServer internal constructor(
try {
withContext(visionManager.context.coroutineContext) {
vision.flowChanges(visionManager, Duration.milliseconds(updateInterval)).collect { update ->
vision.flowChanges(visionManager, updateInterval.milliseconds).collect { update ->
val json = visionManager.jsonFormat.encodeToString(
VisionChange.serializer(),
update