diff --git a/CHANGELOG.md b/CHANGELOG.md index aa539398575..c47f5c59337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`: diff --git a/extensions.gradle b/extensions.gradle index 5399f555dfc..1028b0c59b3 100644 --- a/extensions.gradle +++ b/extensions.gradle @@ -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" diff --git a/gradle.properties b/gradle.properties index 0ab4e4fb47f..45c9a3e51e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bf766c02158..3994cdfed2f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" diff --git a/mppJsAndJavaProject.gradle b/mppJvmJsLinuxMingwProject.gradle similarity index 97% rename from mppJsAndJavaProject.gradle rename to mppJvmJsLinuxMingwProject.gradle index 4b24838a9f3..1a5b08c7de5 100644 --- a/mppJsAndJavaProject.gradle +++ b/mppJvmJsLinuxMingwProject.gradle @@ -15,6 +15,8 @@ kotlin { browser() nodejs() } + linuxX64() + mingwX64() sourceSets { commonMain { diff --git a/startup/launcher/build.gradle b/startup/launcher/build.gradle index e80e77abe88..38fe1179d7a 100644 --- a/startup/launcher/build.gradle +++ b/startup/launcher/build.gradle @@ -4,7 +4,7 @@ plugins { id "application" } -apply from: "$mppJsAndJavaProjectPresetPath" +apply from: "$mppJvmJsLinuxMingwProjectPresetPath" kotlin { sourceSets { diff --git a/startup/plugin/build.gradle b/startup/plugin/build.gradle index 64b4acd8103..97fc6fe3f86 100644 --- a/startup/plugin/build.gradle +++ b/startup/plugin/build.gradle @@ -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 + } + } } } diff --git a/startup/plugin/src/linuxX64Main/kotlin/StartPluginSerializer.kt b/startup/plugin/src/linuxX64Main/kotlin/StartPluginSerializer.kt new file mode 100644 index 00000000000..176d0995bcb --- /dev/null +++ b/startup/plugin/src/linuxX64Main/kotlin/StartPluginSerializer.kt @@ -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 { + private val registeredPlugins = mutableMapOf() + private val registeredPluginsByPlugin = mutableMapOf() + 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 + } +} diff --git a/startup/plugin/src/mingwX64Main/kotlin/StartPluginSerializer.kt b/startup/plugin/src/mingwX64Main/kotlin/StartPluginSerializer.kt new file mode 100644 index 00000000000..176d0995bcb --- /dev/null +++ b/startup/plugin/src/mingwX64Main/kotlin/StartPluginSerializer.kt @@ -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 { + private val registeredPlugins = mutableMapOf() + private val registeredPluginsByPlugin = mutableMapOf() + 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 + } +}