Build update and minor fixes
This commit is contained in:
parent
64a23545f7
commit
5dd40f0226
@ -1,13 +1,10 @@
|
||||
buildscript {
|
||||
extra["kotlinVersion"] = "1.3.20"
|
||||
extra["ioVersion"] = "0.1.2"
|
||||
extra["serializationVersion"] = "0.9.1"
|
||||
extra["coroutinesVersion"] = "1.1.1"
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
|
||||
val kotlinVersion: String by extra
|
||||
val ioVersion: String by extra
|
||||
val coroutinesVersion: String by extra
|
||||
val serializationVersion: String by extra
|
||||
buildscript {
|
||||
val kotlinVersion: String by rootProject.extra("1.3.20")
|
||||
val ioVersion: String by rootProject.extra("0.1.2")
|
||||
val coroutinesVersion: String by rootProject.extra("1.1.1")
|
||||
val serializationVersion: String by rootProject.extra("0.9.1")
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
@ -36,6 +33,21 @@ allprojects {
|
||||
|
||||
group = "hep.dataforge"
|
||||
version = "0.1.1-dev-2"
|
||||
|
||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
targets.all {
|
||||
sourceSets.all {
|
||||
languageSettings.progressiveMode = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file("artifactory.gradle").exists()) {
|
||||
|
@ -1,40 +0,0 @@
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, 'jvm')
|
||||
fromPreset(presets.js, 'js')
|
||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
||||
//fromPreset(presets.iosX64, 'ios')
|
||||
}
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api project(":dataforge-meta")
|
||||
api "org.jetbrains.kotlin:kotlin-reflect"
|
||||
api "io.github.microutils:kotlin-logging-common:1.6.10"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion"
|
||||
}
|
||||
}
|
||||
jvmMain{
|
||||
dependencies{
|
||||
api "io.github.microutils:kotlin-logging:1.6.10"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
|
||||
}
|
||||
}
|
||||
jsMain{
|
||||
dependencies{
|
||||
api "io.github.microutils:kotlin-logging-js:1.6.10"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
dataforge-context/build.gradle.kts
Normal file
35
dataforge-context/build.gradle.kts
Normal file
@ -0,0 +1,35 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
description = "Context and provider definitions"
|
||||
|
||||
val coroutinesVersion: String by rootProject.extra
|
||||
|
||||
kotlin {
|
||||
jvm ()
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(project(":dataforge-meta"))
|
||||
api(kotlin("reflect"))
|
||||
api("io.github.microutils:kotlin-logging-common:1.6.10")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
api("io.github.microutils:kotlin-logging:1.6.10")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api("io.github.microutils:kotlin-logging-js:1.6.10")
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -65,7 +65,7 @@ interface Plugin : Named, Metoid, ContextAware, Provider, MetaRepr {
|
||||
|
||||
override fun toMeta(): Meta = buildMeta {
|
||||
"context" to context.name
|
||||
"type" to this::class.qualifiedName
|
||||
"type" to this::class.simpleName
|
||||
"tag" to tag
|
||||
"meta" to meta
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import hep.dataforge.meta.*
|
||||
import mu.KLogger
|
||||
import mu.KotlinLogging
|
||||
import kotlin.jvm.Synchronized
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
actual object Global: Context, JSContext("GLOBAL", null){
|
||||
/**
|
||||
@ -51,13 +50,6 @@ open class JSContext(
|
||||
override val plugins: PluginManager by lazy { PluginManager(this) }
|
||||
override val logger: KLogger = KotlinLogging.logger(name)
|
||||
|
||||
/**
|
||||
* A property showing that dispatch thread is started in the context
|
||||
*/
|
||||
private var started = false
|
||||
|
||||
override fun <T : Any> services(type: KClass<T>): Sequence<T> = TODO("Not implemented")
|
||||
|
||||
/**
|
||||
* Free up resources associated with this context
|
||||
*
|
||||
|
@ -50,7 +50,7 @@ class PipeAction<in T : Any, out R : Any>(val transform: (Name, Data<T>, Meta) -
|
||||
/**
|
||||
* A simple pipe that performs transformation on the data and copies input meta into the output
|
||||
*/
|
||||
fun <T : Any, R : Any> simple(transform: suspend (Name, T, Meta) -> R) = PipeAction { name, data: Data<T>, meta ->
|
||||
inline fun <T : Any, reified R : Any> simple(noinline transform: suspend (Name, T, Meta) -> R) = PipeAction { name, data: Data<T>, meta ->
|
||||
val goal = data.goal.pipe { transform(name, it, meta) }
|
||||
return@PipeAction Data.of(goal, data.meta)
|
||||
}
|
||||
|
@ -32,15 +32,25 @@ interface Data<out T : Any> : MetaRepr {
|
||||
companion object {
|
||||
fun <T : Any> of(type: KClass<out T>, goal: Goal<T>, meta: Meta): Data<T> = DataImpl(type, goal, meta)
|
||||
inline fun <reified T : Any> of(goal: Goal<T>, meta: Meta): Data<T> = of(T::class, goal, meta)
|
||||
fun <T : Any> of(name: String, goal: Goal<T>, meta: Meta): Data<T> = NamedData(name, of(goal, meta))
|
||||
fun <T : Any> static(context: CoroutineContext, value: T, meta: Meta): Data<T> = DataImpl(value::class, Goal.static(context, value), meta)
|
||||
fun <T : Any> of(name: String, type: KClass<out T>, goal: Goal<T>, meta: Meta): Data<T> =
|
||||
NamedData(name, of(type, goal, meta))
|
||||
|
||||
inline fun <reified T : Any> of(name: String, goal: Goal<T>, meta: Meta): Data<T> =
|
||||
of(name, T::class, goal, meta)
|
||||
|
||||
fun <T : Any> static(context: CoroutineContext, value: T, meta: Meta): Data<T> =
|
||||
DataImpl(value::class, Goal.static(context, value), meta)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic Data implementation
|
||||
*/
|
||||
private class DataImpl<out T : Any>(override val type: KClass<out T>, override val goal: Goal<T>, override val meta: Meta) : Data<T>
|
||||
private class DataImpl<out T : Any>(
|
||||
override val type: KClass<out T>,
|
||||
override val goal: Goal<T>,
|
||||
override val meta: Meta
|
||||
) : Data<T>
|
||||
|
||||
class NamedData<out T : Any>(val name: String, data: Data<T>) : Data<T> by data
|
||||
|
||||
@ -200,8 +210,8 @@ fun <T : Any> DataNode<T>.builder(): DataTreeBuilder<T> = DataTreeBuilder<T>().a
|
||||
fun DataNode<*>.startAll() = asSequence().forEach { (_, data) -> data.goal.start() }
|
||||
|
||||
fun <T : Any> DataNode<T>.filter(predicate: (Name, Data<T>) -> Boolean): DataNode<T> = DataNode.build {
|
||||
asSequence().forEach {(name, data)->
|
||||
if(predicate(name,data)){
|
||||
asSequence().forEach { (name, data) ->
|
||||
if (predicate(name, data)) {
|
||||
this[name] = data
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ repositories {
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, 'jvm')
|
||||
//fromPreset(presets.js, 'js')
|
||||
fromPreset(presets.js, 'js')
|
||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
||||
|
@ -28,6 +28,9 @@ interface OutputManager : Plugin {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an output with given [name], [stage] and reified content type
|
||||
*/
|
||||
inline fun <reified T : Any> OutputManager.typed(name: Name, stage: Name = EmptyName, meta: Meta = EmptyMeta): Output<T> {
|
||||
return typed(T::class, name, stage, meta)
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, 'jvm')
|
||||
fromPreset(presets.js, 'js')
|
||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
||||
//fromPreset(presets.iosX64, 'ios')
|
||||
}
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib-common"
|
||||
|
||||
}
|
||||
}
|
||||
commonTest {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
}
|
||||
}
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
api 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
||||
}
|
||||
}
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-js'
|
||||
}
|
||||
}
|
||||
// iosMain {
|
||||
// }
|
||||
// iosTest {
|
||||
// }
|
||||
}
|
||||
}
|
50
dataforge-meta/build.gradle.kts
Normal file
50
dataforge-meta/build.gradle.kts
Normal file
@ -0,0 +1,50 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
description = "Meta definition and basic operations on meta"
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(kotlin("stdlib"))
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-common"))
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
api(kotlin("stdlib-jdk8"))
|
||||
}
|
||||
}
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test"))
|
||||
implementation(kotlin("test-junit"))
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api(kotlin("stdlib-js"))
|
||||
}
|
||||
}
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
// mingwMain {
|
||||
// }
|
||||
// mingwTest {
|
||||
// }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user