Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/version-3' into version-3
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownJoe796 committed Nov 20, 2024
2 parents 46b57b1 + c701f4c commit 61faa8c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
13 changes: 7 additions & 6 deletions buildSrc/src/main/kotlin/KiteUiPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ class KiteUiPlugin : Plugin<Project> {
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)
}
}
}
Expand All @@ -76,7 +77,7 @@ class KiteUiPlugin : Plugin<Project> {
val resourceFolder = project.file("src/commonMain/resources")
inputs.files(resourceFolder)
doLast {
resourcesJs(gitIgnore, resourceFolder, out, ext)
resourcesJs(listOf(gitIgnore), resourceFolder, out, ext)
}
}
}
Expand All @@ -97,11 +98,11 @@ class KiteUiPlugin : Plugin<Project> {
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)
}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/resourcesPlatforms.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<File>, 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 }
Expand Down
13 changes: 7 additions & 6 deletions gradle-plugin/src/main/kotlin/KiteUiPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ class KiteUiPlugin : Plugin<Project> {
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)
}
}
}
Expand All @@ -76,7 +77,7 @@ class KiteUiPlugin : Plugin<Project> {
val resourceFolder = project.file("src/commonMain/resources")
inputs.files(resourceFolder)
doLast {
resourcesJs(gitIgnore, resourceFolder, out, ext)
resourcesJs(listOf(gitIgnore), resourceFolder, out, ext)
}
}
}
Expand All @@ -97,11 +98,11 @@ class KiteUiPlugin : Plugin<Project> {
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)
}
Expand Down
4 changes: 2 additions & 2 deletions gradle-plugin/src/main/kotlin/resourcesPlatforms.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<File>, 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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,8 +44,8 @@ fun <T> Properties.decodeFromStringMap(serializer: KSerializer<T>, key: String,
if(filtered.isEmpty()) return null
return decodeFromStringMap(Wrapper.serializer(serializer), filtered).value
}
inline fun <reified T> Properties.decodeFromStringMap(key: String, source: Map<String, String>, into: ImmediateWritable<T>) {
decodeFromStringMap(serializersModule.serializer<T>(), key, source)?.let { into.value = it }
inline fun <reified T> Properties.decodeFromStringMap(key: String, source: Map<String, String>, into: ImmediateWriteOnly<T>) {
decodeFromStringMap(serializersModule.serializer<T>(), key, source)?.let { into.setImmediate(it) }
}
inline fun <reified T> Properties.encodeToStringMap(value: T, key: String, out: MutableMap<String, String>) = encodeToStringMap(UrlProperties.serializersModule.serializer<T>(), value, key, out)
inline fun <reified T> Properties.decodeFromStringMap(key: String, source: Map<String, String>): T? = decodeFromStringMap(UrlProperties.serializersModule.serializer<T>(), key, source)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ class Property<T>(startValue: T) : ImmediateWritable<T>, BaseImmediateReadable<T
}
}

class LateInitProperty<T>() : Writable<T>, BaseReadable<T>() {
class LateInitProperty<T>() : Writable<T>, ImmediateWriteOnly<T>, BaseReadable<T>() {
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
}

Expand Down

0 comments on commit 61faa8c

Please sign in to comment.