Update build.
This commit is contained in:
parent
9648533ac8
commit
3198bad094
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@ build/
|
||||
data/
|
||||
|
||||
!gradle-wrapper.jar
|
||||
|
||||
/kotlin-js-store/yarn.lock
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
||||
- Context receivers flag
|
||||
|
||||
### Changed
|
||||
- Naming of Canvas3D options
|
||||
- Lights are added to the scene instead of 3D options
|
||||
- Lights are added to the scene instead of 3D options
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
@ -8,7 +8,7 @@ val fxVersion by extra("11")
|
||||
|
||||
allprojects{
|
||||
group = "space.kscience"
|
||||
version = "0.2.1-dev-1"
|
||||
version = "0.3.0-dev-1"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
@ -45,8 +45,9 @@ kotlin {
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("io.ktor-server-cio:${npmlibs.versions.ktor}")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:${npmlibs.versions.ktor}")
|
||||
implementation("io.ktor:ktor-server-cio:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-server-content-negotiation:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:${ktorVersion}")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
|
@ -1,24 +1,22 @@
|
||||
package ru.mipt.npm.muon.monitor.server
|
||||
|
||||
|
||||
import io.ktor.application.Application
|
||||
import io.ktor.application.call
|
||||
import io.ktor.application.install
|
||||
import io.ktor.application.log
|
||||
import io.ktor.features.CallLogging
|
||||
import io.ktor.features.ContentNegotiation
|
||||
import io.ktor.features.DefaultHeaders
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.http.content.resources
|
||||
import io.ktor.http.content.static
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Routing
|
||||
import io.ktor.routing.get
|
||||
import io.ktor.serialization.json
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import io.ktor.server.application.Application
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.application.log
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.http.content.resources
|
||||
import io.ktor.server.http.content.static
|
||||
import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.Routing
|
||||
import io.ktor.server.routing.get
|
||||
import org.apache.commons.math3.random.JDKRandomGenerator
|
||||
import ru.mipt.npm.muon.monitor.Model
|
||||
import ru.mipt.npm.muon.monitor.sim.Cos2TrackGenerator
|
||||
@ -40,8 +38,6 @@ fun Application.module(context: Context = Global) {
|
||||
environment.log.info("Current directory: $currentDir")
|
||||
val solidManager = context.fetch(Solids)
|
||||
|
||||
install(DefaultHeaders)
|
||||
install(CallLogging)
|
||||
install(ContentNegotiation) {
|
||||
json()
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ kotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
freeCompilerArgs =
|
||||
freeCompilerArgs + "-Xjvm-default=all" + "-Xopt-in=kotlin.RequiresOptIn" + "-Xlambdas=indy"
|
||||
freeCompilerArgs + "-Xjvm-default=all" + "-Xopt-in=kotlin.RequiresOptIn" + "-Xlambdas=indy" + "-Xcontext-receivers"
|
||||
}
|
||||
}
|
||||
testRuns["test"].executionTask.configure {
|
||||
|
@ -3,5 +3,6 @@ kotlin.mpp.stability.nowarn=true
|
||||
kotlin.jupyter.add.scanner=false
|
||||
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
toolsVersion=0.11.4-kotlin-1.6.20
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -30,7 +30,7 @@ public external interface TabPaneProps : PropsWithChildren {
|
||||
public val TabPane: FC<TabPaneProps> = fc("TabPane") { props ->
|
||||
var activeTab: String? by useState(props.activeTab)
|
||||
|
||||
val children: Array<out ReactElement?> = Children.map(props.children) {
|
||||
val children: Array<out ReactElement<*>?> = Children.map(props.children) {
|
||||
it.asElementOrNull()
|
||||
} ?: emptyArray()
|
||||
|
||||
|
@ -2,9 +2,12 @@ plugins {
|
||||
id("ru.mipt.npm.gradle.jvm")
|
||||
}
|
||||
|
||||
val ktorVersion = npmlibs.versions.ktor.get()
|
||||
|
||||
dependencies {
|
||||
api(project(":visionforge-core"))
|
||||
api("io.ktor-server-cio:${npmlibs.versions.ktor}")
|
||||
api("io.ktor:ktor-server-html-builder:${npmlibs.versions.ktor}")
|
||||
api("io.ktor:ktor-server-websockets:${npmlibs.versions.ktor}")
|
||||
api("io.ktor:ktor-server-cio:${ktorVersion}")
|
||||
api("io.ktor:ktor-server-html-builder:${ktorVersion}")
|
||||
api("io.ktor:ktor-server-websockets:${ktorVersion}")
|
||||
implementation("io.ktor:ktor-server-cors:${ktorVersion}")
|
||||
}
|
@ -1,24 +1,25 @@
|
||||
package space.kscience.visionforge.server
|
||||
|
||||
import io.ktor.application.*
|
||||
import io.ktor.features.CORS
|
||||
import io.ktor.features.CallLogging
|
||||
import io.ktor.html.respondHtml
|
||||
import io.ktor.http.*
|
||||
import io.ktor.http.cio.websocket.Frame
|
||||
import io.ktor.http.content.resources
|
||||
import io.ktor.http.content.static
|
||||
import io.ktor.response.respond
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.ApplicationEngine
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.util.getOrFail
|
||||
import io.ktor.websocket.WebSockets
|
||||
import io.ktor.websocket.webSocket
|
||||
import io.ktor.server.html.respondHtml
|
||||
import io.ktor.server.http.content.resources
|
||||
import io.ktor.server.http.content.static
|
||||
import io.ktor.server.plugins.cors.CORS
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.*
|
||||
import io.ktor.server.util.getOrFail
|
||||
import io.ktor.server.websocket.WebSockets
|
||||
import io.ktor.server.websocket.webSocket
|
||||
import io.ktor.websocket.Frame
|
||||
import kotlinx.coroutines.channels.consumeEach
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.html.*
|
||||
@ -130,13 +131,13 @@ public class VisionServer internal constructor(
|
||||
|
||||
try {
|
||||
withContext(visionManager.context.coroutineContext) {
|
||||
vision.flowChanges(updateInterval.milliseconds).collect { update ->
|
||||
vision.flowChanges(updateInterval.milliseconds).onEach { update ->
|
||||
val json = visionManager.jsonFormat.encodeToString(
|
||||
VisionChange.serializer(),
|
||||
update
|
||||
)
|
||||
outgoing.send(Frame.Text(json))
|
||||
}
|
||||
}.collect()
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
application.log.info("WebSocket update channel for $name is closed with exception: $t")
|
||||
@ -241,21 +242,16 @@ public fun Application.visionServer(
|
||||
webServerUrl: Url,
|
||||
path: String = DEFAULT_PAGE,
|
||||
): VisionServer {
|
||||
if (featureOrNull(WebSockets) == null) {
|
||||
install(WebSockets)
|
||||
install(WebSockets)
|
||||
install(CORS) {
|
||||
anyHost()
|
||||
}
|
||||
|
||||
if (featureOrNull(CORS) == null) {
|
||||
install(CORS) {
|
||||
anyHost()
|
||||
}
|
||||
}
|
||||
// if (pluginOrNull(CallLogging) == null) {
|
||||
// install(CallLogging)
|
||||
// }
|
||||
|
||||
if (featureOrNull(CallLogging) == null) {
|
||||
install(CallLogging)
|
||||
}
|
||||
|
||||
val serverRoute = (featureOrNull(Routing) ?: install(Routing)).createRouteFromPath(path)
|
||||
val serverRoute = install(Routing).createRouteFromPath(path)
|
||||
|
||||
serverRoute {
|
||||
static {
|
||||
@ -263,7 +259,7 @@ public fun Application.visionServer(
|
||||
}
|
||||
}
|
||||
|
||||
return VisionServer(visionManager, webServerUrl.copy(encodedPath = path), serverRoute)
|
||||
return VisionServer(visionManager, URLBuilder(webServerUrl).apply { encodedPath = path }.build(), serverRoute)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
package space.kscience.visionforge.tables
|
||||
|
||||
import kotlinext.js.jso
|
||||
import kotlinx.js.jso
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLElement
|
||||
import space.kscience.dataforge.context.AbstractPlugin
|
||||
|
@ -4,7 +4,6 @@ package space.kscience.visionforge.solid.three
|
||||
import info.laht.threekt.core.Object3D
|
||||
import info.laht.threekt.geometries.TextBufferGeometry
|
||||
import info.laht.threekt.objects.Mesh
|
||||
import kotlinext.js.jsObject
|
||||
import kotlinext.js.jso
|
||||
import space.kscience.dataforge.context.logger
|
||||
import space.kscience.dataforge.context.warn
|
||||
|
Loading…
Reference in New Issue
Block a user