Merge pull request #233 from InsanusMokrassar/0.17.7

0.17.7
This commit is contained in:
InsanusMokrassar 2023-04-18 19:37:06 +06:00 committed by GitHub
commit 6d8a8ab018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 7 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 0.17.7
* `Versions`:
* `Android CoreKtx`: `1.9.0` -> `1.10.0`
* `Startup`:
* Add support of `linuxX64` and `mingwX64` platforms
## 0.17.6
* `Versions`:

View File

@ -23,7 +23,7 @@ allprojects {
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
mppProjectWithSerializationAndComposePresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerializationAndCompose.gradle"
mppJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJavaProject.gradle"
mppJsAndJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsAndJavaProject.gradle"
mppJvmJsLinuxMingwProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJvmJsLinuxMingwProject.gradle"
mppAndroidProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppAndroidProject.gradle"
defaultAndroidSettingsPresetPath = "${rootProject.projectDir.absolutePath}/defaultAndroidSettings.gradle"

View File

@ -14,5 +14,5 @@ crypto_js_version=4.1.1
# Project data
group=dev.inmo
version=0.17.6
android_code_version=188
version=0.17.7
android_code_version=189

View File

@ -21,13 +21,13 @@ koin = "3.4.0"
okio = "3.3.0"
ksp = "1.8.20-1.0.10"
ksp = "1.8.20-1.0.11"
kotlin-poet = "1.13.0"
android-gradle = "7.3.1"
dexcount = "4.0.0"
android-coreKtx = "1.9.0"
android-coreKtx = "1.10.0"
android-recyclerView = "1.3.0"
android-appCompat = "1.6.1"
android-fragment = "1.5.6"

View File

@ -15,6 +15,8 @@ kotlin {
browser()
nodejs()
}
linuxX64()
mingwX64()
sourceSets {
commonMain {

View File

@ -4,7 +4,7 @@ plugins {
id "application"
}
apply from: "$mppJsAndJavaProjectPresetPath"
apply from: "$mppJvmJsLinuxMingwProjectPresetPath"
kotlin {
sourceSets {

View File

@ -3,7 +3,7 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization"
}
apply from: "$mppJsAndJavaProjectPresetPath"
apply from: "$mppJvmJsLinuxMingwProjectPresetPath"
kotlin {
sourceSets {
@ -21,5 +21,15 @@ kotlin {
api libs.uuid
}
}
linuxX64Main {
dependencies {
api libs.uuid
}
}
mingwX64Main {
dependencies {
api libs.uuid
}
}
}
}

View File

@ -0,0 +1,36 @@
package dev.inmo.micro_utils.startup.plugin
import com.benasher44.uuid.uuid4
import kotlinx.serialization.KSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlin.reflect.KClass
actual object StartPluginSerializer : KSerializer<StartPlugin> {
private val registeredPlugins = mutableMapOf<String, StartPlugin>()
private val registeredPluginsByPlugin = mutableMapOf<StartPlugin, String>()
override val descriptor: SerialDescriptor = String.serializer().descriptor
override fun deserialize(decoder: Decoder): StartPlugin {
val name = decoder.decodeString()
return registeredPlugins[name] ?: error("Unable to find startup plugin for $name")
}
override fun serialize(encoder: Encoder, value: StartPlugin) {
val name = registeredPluginsByPlugin[value] ?: uuid4().toString().also {
registeredPlugins[it] = value
registeredPluginsByPlugin[value] = it
}
encoder.encodeString(name)
}
/**
* Register plugin inside of this [KSerializer]. Since plugin has been registered, you may use its [name] in any
* serialized [dev.inmo.micro_utils.startup.launcher.Config] to retrieve [plugin] you passed here
*/
fun registerPlugin(name: String, plugin: StartPlugin) {
registeredPlugins[name] = plugin
}
}

View File

@ -0,0 +1,36 @@
package dev.inmo.micro_utils.startup.plugin
import com.benasher44.uuid.uuid4
import kotlinx.serialization.KSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlin.reflect.KClass
actual object StartPluginSerializer : KSerializer<StartPlugin> {
private val registeredPlugins = mutableMapOf<String, StartPlugin>()
private val registeredPluginsByPlugin = mutableMapOf<StartPlugin, String>()
override val descriptor: SerialDescriptor = String.serializer().descriptor
override fun deserialize(decoder: Decoder): StartPlugin {
val name = decoder.decodeString()
return registeredPlugins[name] ?: error("Unable to find startup plugin for $name")
}
override fun serialize(encoder: Encoder, value: StartPlugin) {
val name = registeredPluginsByPlugin[value] ?: uuid4().toString().also {
registeredPlugins[it] = value
registeredPluginsByPlugin[value] = it
}
encoder.encodeString(name)
}
/**
* Register plugin inside of this [KSerializer]. Since plugin has been registered, you may use its [name] in any
* serialized [dev.inmo.micro_utils.startup.launcher.Config] to retrieve [plugin] you passed here
*/
fun registerPlugin(name: String, plugin: StartPlugin) {
registeredPlugins[name] = plugin
}
}