diff --git a/buildSrc/src/main/kotlin/KiteUiPlugin.kt b/buildSrc/src/main/kotlin/KiteUiPlugin.kt index 8c45f30e..90b8e21d 100644 --- a/buildSrc/src/main/kotlin/KiteUiPlugin.kt +++ b/buildSrc/src/main/kotlin/KiteUiPlugin.kt @@ -50,15 +50,16 @@ class KiteUiPlugin : Plugin { into("src/jsMain/resources/public/common") afterEvaluate { // tasks.findByName("compileKotlinJs")?.dependsOn(task) - val out = project.file("src/jsMain/kotlin/${ext.packageName.replace(".", "/")}/ResourcesActual.kt") val gitIgnore = project.file("src/jsMain/resources/common/.gitignore") + val publicGitIgnore = project.file("src/jsMain/resources/public/common/.gitignore") outputs.file(out) outputs.file(gitIgnore) + outputs.file(publicGitIgnore) val resourceFolder = project.file("src/commonMain/resources") inputs.files(resourceFolder) doLast { - resourcesJs(gitIgnore, resourceFolder, out, ext) + resourcesJs(listOf(gitIgnore, publicGitIgnore), resourceFolder, out, ext) } } } @@ -76,7 +77,7 @@ class KiteUiPlugin : Plugin { val resourceFolder = project.file("src/commonMain/resources") inputs.files(resourceFolder) doLast { - resourcesJs(gitIgnore, resourceFolder, out, ext) + resourcesJs(listOf(gitIgnore), resourceFolder, out, ext) } } } @@ -97,11 +98,11 @@ class KiteUiPlugin : Plugin { val outAssets = outProject.resolve("Assets.xcassets") val outNonAssets = outProject.resolve("resourcesFromCommon") val outPlist = outProject.resolve("Info.plist") - outputs.files(outAssets) - outputs.files(outNonAssets) + outputs.dir(outAssets) + outputs.dir(outNonAssets) outputs.file(outPlist) val resourceFolder = project.file("src/commonMain/resources") - inputs.files(resourceFolder) + inputs.dir(resourceFolder) doLast { resourcesIos(resourceFolder, outPlist, outNonAssets, outAssets, outKt, ext) } diff --git a/buildSrc/src/main/kotlin/resourcesPlatforms.kt b/buildSrc/src/main/kotlin/resourcesPlatforms.kt index 8164874c..e10808c4 100644 --- a/buildSrc/src/main/kotlin/resourcesPlatforms.kt +++ b/buildSrc/src/main/kotlin/resourcesPlatforms.kt @@ -40,9 +40,9 @@ internal fun resourcesCommon(resourceFolder: File, out: File, ext: KiteUiPluginE ) } -internal fun resourcesJs(gitIgnore: File, resourceFolder: File, out: File, ext: KiteUiPluginExtension) { +internal fun resourcesJs(gitIgnores: List, resourceFolder: File, out: File, ext: KiteUiPluginExtension) { var usesBlob = false - gitIgnore.writeText("*\n") + gitIgnores.forEach { it.writeText("*\n") } val lines = resourceFolder.resources() .entries .sortedBy { it.key } diff --git a/gradle-plugin/src/main/kotlin/KiteUiPlugin.kt b/gradle-plugin/src/main/kotlin/KiteUiPlugin.kt index 0e47a8f8..756b16e0 100644 --- a/gradle-plugin/src/main/kotlin/KiteUiPlugin.kt +++ b/gradle-plugin/src/main/kotlin/KiteUiPlugin.kt @@ -50,15 +50,16 @@ class KiteUiPlugin : Plugin { into("src/jsMain/resources/public/common") afterEvaluate { // tasks.findByName("compileKotlinJs")?.dependsOn(task) - val out = project.file("src/jsMain/kotlin/${ext.packageName.replace(".", "/")}/ResourcesActual.kt") val gitIgnore = project.file("src/jsMain/resources/common/.gitignore") + val publicGitIgnore = project.file("src/jsMain/resources/public/common/.gitignore") outputs.file(out) outputs.file(gitIgnore) + outputs.file(publicGitIgnore) val resourceFolder = project.file("src/commonMain/resources") inputs.files(resourceFolder) doLast { - resourcesJs(gitIgnore, resourceFolder, out, ext) + resourcesJs(listOf(gitIgnore, publicGitIgnore), resourceFolder, out, ext) } } } @@ -76,7 +77,7 @@ class KiteUiPlugin : Plugin { val resourceFolder = project.file("src/commonMain/resources") inputs.files(resourceFolder) doLast { - resourcesJs(gitIgnore, resourceFolder, out, ext) + resourcesJs(listOf(gitIgnore), resourceFolder, out, ext) } } } @@ -97,11 +98,11 @@ class KiteUiPlugin : Plugin { val outAssets = outProject.resolve("Assets.xcassets") val outNonAssets = outProject.resolve("resourcesFromCommon") val outPlist = outProject.resolve("Info.plist") - outputs.files(outAssets) - outputs.files(outNonAssets) + outputs.dir(outAssets) + outputs.dir(outNonAssets) outputs.file(outPlist) val resourceFolder = project.file("src/commonMain/resources") - inputs.files(resourceFolder) + inputs.dir(resourceFolder) doLast { resourcesIos(resourceFolder, outPlist, outNonAssets, outAssets, outKt, ext) } diff --git a/gradle-plugin/src/main/kotlin/resourcesPlatforms.kt b/gradle-plugin/src/main/kotlin/resourcesPlatforms.kt index 8164874c..e10808c4 100644 --- a/gradle-plugin/src/main/kotlin/resourcesPlatforms.kt +++ b/gradle-plugin/src/main/kotlin/resourcesPlatforms.kt @@ -40,9 +40,9 @@ internal fun resourcesCommon(resourceFolder: File, out: File, ext: KiteUiPluginE ) } -internal fun resourcesJs(gitIgnore: File, resourceFolder: File, out: File, ext: KiteUiPluginExtension) { +internal fun resourcesJs(gitIgnores: List, resourceFolder: File, out: File, ext: KiteUiPluginExtension) { var usesBlob = false - gitIgnore.writeText("*\n") + gitIgnores.forEach { it.writeText("*\n") } val lines = resourceFolder.resources() .entries .sortedBy { it.key } diff --git a/library/src/commonMain/kotlin/com/lightningkite/kiteui/navigation/urls.kt b/library/src/commonMain/kotlin/com/lightningkite/kiteui/navigation/urls.kt index 732fb454..9aca2dd3 100644 --- a/library/src/commonMain/kotlin/com/lightningkite/kiteui/navigation/urls.kt +++ b/library/src/commonMain/kotlin/com/lightningkite/kiteui/navigation/urls.kt @@ -5,6 +5,7 @@ package com.lightningkite.kiteui.navigation import com.lightningkite.kiteui.decodeURIComponent import com.lightningkite.kiteui.encodeURIComponent import com.lightningkite.kiteui.reactive.ImmediateWritable +import com.lightningkite.kiteui.reactive.ImmediateWriteOnly import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable @@ -43,8 +44,8 @@ fun Properties.decodeFromStringMap(serializer: KSerializer, key: String, if(filtered.isEmpty()) return null return decodeFromStringMap(Wrapper.serializer(serializer), filtered).value } -inline fun Properties.decodeFromStringMap(key: String, source: Map, into: ImmediateWritable) { - decodeFromStringMap(serializersModule.serializer(), key, source)?.let { into.value = it } +inline fun Properties.decodeFromStringMap(key: String, source: Map, into: ImmediateWriteOnly) { + decodeFromStringMap(serializersModule.serializer(), key, source)?.let { into.setImmediate(it) } } inline fun Properties.encodeToStringMap(value: T, key: String, out: MutableMap) = encodeToStringMap(UrlProperties.serializersModule.serializer(), value, key, out) inline fun Properties.decodeFromStringMap(key: String, source: Map): T? = decodeFromStringMap(UrlProperties.serializersModule.serializer(), key, source) diff --git a/library/src/commonMain/kotlin/com/lightningkite/kiteui/reactive/BaseListenable.kt b/library/src/commonMain/kotlin/com/lightningkite/kiteui/reactive/BaseListenable.kt index aeaa83be..2ba0fc45 100644 --- a/library/src/commonMain/kotlin/com/lightningkite/kiteui/reactive/BaseListenable.kt +++ b/library/src/commonMain/kotlin/com/lightningkite/kiteui/reactive/BaseListenable.kt @@ -77,14 +77,14 @@ class Property(startValue: T) : ImmediateWritable, BaseImmediateReadable() : Writable, BaseReadable() { +class LateInitProperty() : Writable, ImmediateWriteOnly, BaseReadable() { var value: T get() = state.get() set(value) { state = ReadableState(value) } - override suspend infix fun set(value: T) { + override fun setImmediate(value: T) { this.value = value }