From 89d78c43bbc148d67bb61025502a6a085f8a68c5 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 3 Aug 2024 21:26:50 +0300 Subject: [PATCH] Add wasm and native targets to core modules --- build.gradle.kts | 2 +- controls-constructor/build.gradle.kts | 2 ++ controls-core/build.gradle.kts | 1 + .../src/wasmJsMain/kotlin/fromSpec.wasm.kt | 9 +++++++++ controls-magix/build.gradle.kts | 1 + .../kscience/controls/demo/car/IVirtualCar.kt | 0 .../controls/demo/car/MagixVirtualCar.kt | 0 .../kscience/controls/demo/car/VirtualCar.kt | 0 .../controls/demo/car/VirtualCarController.kt | 0 .../src/{main => jvmMain}/kotlin/zmq.kt | 0 magix/magix-api/build.gradle.kts | 1 + magix/magix-mqtt/build.gradle.kts | 15 +++++++++------ .../magix/rabbit/RabbitMQMagixEndpoint.kt | 0 .../magix-storage-xodus/build.gradle.kts | 18 +++++++++++------- magix/magix-zmq/build.gradle.kts | 13 ++++++++----- .../kscince/magix/zmq/ZmqMagixEndpoint.kt | 0 .../kscince/magix/zmq/ZmqMagixFlowPlugin.kt | 1 - 17 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 controls-core/src/wasmJsMain/kotlin/fromSpec.wasm.kt rename demo/car/src/{main => jvmMain}/kotlin/space/kscience/controls/demo/car/IVirtualCar.kt (100%) rename demo/car/src/{main => jvmMain}/kotlin/space/kscience/controls/demo/car/MagixVirtualCar.kt (100%) rename demo/car/src/{main => jvmMain}/kotlin/space/kscience/controls/demo/car/VirtualCar.kt (100%) rename demo/car/src/{main => jvmMain}/kotlin/space/kscience/controls/demo/car/VirtualCarController.kt (100%) rename demo/magix-demo/src/{main => jvmMain}/kotlin/zmq.kt (100%) rename magix/magix-rabbit/src/{main => jvmMain}/kotlin/space/kscience/magix/rabbit/RabbitMQMagixEndpoint.kt (100%) rename magix/magix-zmq/src/{main => jvmMain}/kotlin/space/kscince/magix/zmq/ZmqMagixEndpoint.kt (100%) rename magix/magix-zmq/src/{main => jvmMain}/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt (97%) diff --git a/build.gradle.kts b/build.gradle.kts index b9b6d19..619a512 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.4.0-dev-5" + version = "0.4.0-dev-6" repositories{ google() } diff --git a/controls-constructor/build.gradle.kts b/controls-constructor/build.gradle.kts index 008a242..1947f91 100644 --- a/controls-constructor/build.gradle.kts +++ b/controls-constructor/build.gradle.kts @@ -10,6 +10,8 @@ description = """ kscience{ jvm() js() + native() + wasm() useCoroutines() useSerialization() commonMain { diff --git a/controls-core/build.gradle.kts b/controls-core/build.gradle.kts index 9624b35..868cdd0 100644 --- a/controls-core/build.gradle.kts +++ b/controls-core/build.gradle.kts @@ -13,6 +13,7 @@ kscience { jvm() js() native() + wasm() useCoroutines() useSerialization{ json() diff --git a/controls-core/src/wasmJsMain/kotlin/fromSpec.wasm.kt b/controls-core/src/wasmJsMain/kotlin/fromSpec.wasm.kt new file mode 100644 index 0000000..cd77248 --- /dev/null +++ b/controls-core/src/wasmJsMain/kotlin/fromSpec.wasm.kt @@ -0,0 +1,9 @@ +package space.kscience.controls.spec + +import space.kscience.controls.api.ActionDescriptor +import space.kscience.controls.api.PropertyDescriptor +import kotlin.reflect.KProperty + +internal actual fun PropertyDescriptor.fromSpec(property: KProperty<*>){} + +internal actual fun ActionDescriptor.fromSpec(property: KProperty<*>){} \ No newline at end of file diff --git a/controls-magix/build.gradle.kts b/controls-magix/build.gradle.kts index ea03a7e..1425eb0 100644 --- a/controls-magix/build.gradle.kts +++ b/controls-magix/build.gradle.kts @@ -13,6 +13,7 @@ kscience { jvm() js() native() + wasm() useCoroutines() useSerialization { json() diff --git a/demo/car/src/main/kotlin/space/kscience/controls/demo/car/IVirtualCar.kt b/demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/IVirtualCar.kt similarity index 100% rename from demo/car/src/main/kotlin/space/kscience/controls/demo/car/IVirtualCar.kt rename to demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/IVirtualCar.kt diff --git a/demo/car/src/main/kotlin/space/kscience/controls/demo/car/MagixVirtualCar.kt b/demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/MagixVirtualCar.kt similarity index 100% rename from demo/car/src/main/kotlin/space/kscience/controls/demo/car/MagixVirtualCar.kt rename to demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/MagixVirtualCar.kt diff --git a/demo/car/src/main/kotlin/space/kscience/controls/demo/car/VirtualCar.kt b/demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/VirtualCar.kt similarity index 100% rename from demo/car/src/main/kotlin/space/kscience/controls/demo/car/VirtualCar.kt rename to demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/VirtualCar.kt diff --git a/demo/car/src/main/kotlin/space/kscience/controls/demo/car/VirtualCarController.kt b/demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/VirtualCarController.kt similarity index 100% rename from demo/car/src/main/kotlin/space/kscience/controls/demo/car/VirtualCarController.kt rename to demo/car/src/jvmMain/kotlin/space/kscience/controls/demo/car/VirtualCarController.kt diff --git a/demo/magix-demo/src/main/kotlin/zmq.kt b/demo/magix-demo/src/jvmMain/kotlin/zmq.kt similarity index 100% rename from demo/magix-demo/src/main/kotlin/zmq.kt rename to demo/magix-demo/src/jvmMain/kotlin/zmq.kt diff --git a/magix/magix-api/build.gradle.kts b/magix/magix-api/build.gradle.kts index 68151c3..253f3e3 100644 --- a/magix/magix-api/build.gradle.kts +++ b/magix/magix-api/build.gradle.kts @@ -13,6 +13,7 @@ kscience { jvm() js() native() + wasm() useCoroutines() useSerialization{ json() diff --git a/magix/magix-mqtt/build.gradle.kts b/magix/magix-mqtt/build.gradle.kts index 5261a00..9241929 100644 --- a/magix/magix-mqtt/build.gradle.kts +++ b/magix/magix-mqtt/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("space.kscience.gradle.jvm") + id("space.kscience.gradle.mpp") `maven-publish` } @@ -7,12 +7,15 @@ description = """ MQTT client magix endpoint """.trimIndent() -dependencies { - api(projects.magix.magixApi) - implementation(libs.hivemq.mqtt.client) - implementation(spclibs.kotlinx.coroutines.jdk8) +kscience { + jvm() + jvmMain { + api(projects.magix.magixApi) + implementation(libs.hivemq.mqtt.client) + implementation(spclibs.kotlinx.coroutines.jdk8) + } } -readme{ +readme { maturity = space.kscience.gradle.Maturity.PROTOTYPE } diff --git a/magix/magix-rabbit/src/main/kotlin/space/kscience/magix/rabbit/RabbitMQMagixEndpoint.kt b/magix/magix-rabbit/src/jvmMain/kotlin/space/kscience/magix/rabbit/RabbitMQMagixEndpoint.kt similarity index 100% rename from magix/magix-rabbit/src/main/kotlin/space/kscience/magix/rabbit/RabbitMQMagixEndpoint.kt rename to magix/magix-rabbit/src/jvmMain/kotlin/space/kscience/magix/rabbit/RabbitMQMagixEndpoint.kt diff --git a/magix/magix-storage/magix-storage-xodus/build.gradle.kts b/magix/magix-storage/magix-storage-xodus/build.gradle.kts index f50abe3..6c35cef 100644 --- a/magix/magix-storage/magix-storage-xodus/build.gradle.kts +++ b/magix/magix-storage/magix-storage-xodus/build.gradle.kts @@ -1,20 +1,24 @@ plugins { - id("space.kscience.gradle.jvm") + id("space.kscience.gradle.mpp") `maven-publish` } kscience { + jvm() useCoroutines() -} - -dependencies { - api(projects.magix.magixStorage) - implementation(libs.xodus.entity.store) + jvmMain { + api(projects.magix.magixStorage) + implementation(libs.xodus.entity.store) // implementation("org.jetbrains.xodus:dnq:2.0.0") - testImplementation(spclibs.kotlinx.coroutines.test) + } + + jvmTest{ + implementation(spclibs.kotlinx.coroutines.test) + } } + readme { maturity = space.kscience.gradle.Maturity.PROTOTYPE } diff --git a/magix/magix-zmq/build.gradle.kts b/magix/magix-zmq/build.gradle.kts index 20cc246..7eedafa 100644 --- a/magix/magix-zmq/build.gradle.kts +++ b/magix/magix-zmq/build.gradle.kts @@ -1,7 +1,7 @@ import space.kscience.gradle.Maturity plugins { - id("space.kscience.gradle.jvm") + id("space.kscience.gradle.mpp") `maven-publish` } @@ -9,10 +9,13 @@ description = """ ZMQ client endpoint for Magix """.trimIndent() -dependencies { - api(projects.magix.magixApi) - api("org.slf4j:slf4j-api:2.0.6") - api("org.zeromq:jeromq:0.5.3") +kscience { + jvm() + jvmMain { + api(projects.magix.magixApi) + api("org.slf4j:slf4j-api:2.0.6") + api("org.zeromq:jeromq:0.5.3") + } } readme { diff --git a/magix/magix-zmq/src/main/kotlin/space/kscince/magix/zmq/ZmqMagixEndpoint.kt b/magix/magix-zmq/src/jvmMain/kotlin/space/kscince/magix/zmq/ZmqMagixEndpoint.kt similarity index 100% rename from magix/magix-zmq/src/main/kotlin/space/kscince/magix/zmq/ZmqMagixEndpoint.kt rename to magix/magix-zmq/src/jvmMain/kotlin/space/kscince/magix/zmq/ZmqMagixEndpoint.kt diff --git a/magix/magix-zmq/src/main/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt b/magix/magix-zmq/src/jvmMain/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt similarity index 97% rename from magix/magix-zmq/src/main/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt rename to magix/magix-zmq/src/jvmMain/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt index 7813b8c..c35aa39 100644 --- a/magix/magix-zmq/src/main/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt +++ b/magix/magix-zmq/src/jvmMain/kotlin/space/kscince/magix/zmq/ZmqMagixFlowPlugin.kt @@ -4,7 +4,6 @@ import kotlinx.coroutines.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach -import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import org.slf4j.LoggerFactory import org.zeromq.SocketType