From 1bfcebc00b07328a5db242dd746766b4d0d923af Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 13 Dec 2023 17:35:54 +0300 Subject: [PATCH 1/5] fix package of android logging plugin --- .../androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt | 2 ++ .../respawn/flowmvi}/plugins/PlatformLoggingPlugin.kt | 0 2 files changed, 2 insertions(+) rename core/src/androidMain/kotlin/{pro.respawn.flowmvi => pro/respawn/flowmvi}/plugins/PlatformLoggingPlugin.kt (100%) diff --git a/core/src/androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt b/core/src/androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt index b209aa07..76db4516 100644 --- a/core/src/androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt +++ b/core/src/androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt @@ -6,6 +6,8 @@ import pro.respawn.flowmvi.api.IntentReceiver import pro.respawn.flowmvi.api.MVIAction import pro.respawn.flowmvi.api.MVIIntent +// TODO: KMP Does not support sharing code between Android and JVM, hence the duplicate + /** * An alias for [IntentReceiver.send] */ diff --git a/core/src/androidMain/kotlin/pro.respawn.flowmvi/plugins/PlatformLoggingPlugin.kt b/core/src/androidMain/kotlin/pro/respawn/flowmvi/plugins/PlatformLoggingPlugin.kt similarity index 100% rename from core/src/androidMain/kotlin/pro.respawn.flowmvi/plugins/PlatformLoggingPlugin.kt rename to core/src/androidMain/kotlin/pro/respawn/flowmvi/plugins/PlatformLoggingPlugin.kt From 2eda35f5c0fe15f65da2d42199bc7f097bfd1583 Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 13 Dec 2023 17:36:30 +0300 Subject: [PATCH 2/5] fix recoverable not catching all exceptions --- .../commonMain/kotlin/pro/respawn/flowmvi/api/Recoverable.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/api/Recoverable.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/api/Recoverable.kt index 6a0ff66b..74eb4b76 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/api/Recoverable.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/api/Recoverable.kt @@ -1,6 +1,5 @@ package pro.respawn.flowmvi.api -import kotlinx.coroutines.withContext import kotlin.coroutines.CoroutineContext import kotlin.coroutines.cancellation.CancellationException @@ -29,9 +28,7 @@ public fun interface Recoverable : C throw e } catch (expected: Exception) { if (coroutineContext[Recoverable] != null) throw expected - withContext(this@Recoverable) { - recover(expected) - } + recover(expected) } @DelicateStoreApi From 69425a1c7344da8be14c7af6684bab621f29529e Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 13 Dec 2023 17:38:25 +0300 Subject: [PATCH 3/5] update build configuration --- .gitignore | 1 + build.gradle.kts | 9 ++-- buildSrc/src/main/kotlin/ConfigureAndroid.kt | 2 +- .../src/main/kotlin/ConfigureMultiplatform.kt | 54 +++++++++---------- .../src/main/kotlin/ConfigurePublication.kt | 5 +- buildSrc/src/main/kotlin/Util.kt | 10 ++++ 6 files changed, 44 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 921880c6..29e7cd8f 100644 --- a/.gitignore +++ b/.gitignore @@ -170,3 +170,4 @@ hs_err_pid* # yarn.lock location & other /kotlin-js-store/** /.idea/appInsightsSettings.xml +/.idea/deploymentTargetSelector.xml diff --git a/build.gradle.kts b/build.gradle.kts index 71a75929..49d5cd7e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import nl.littlerobots.vcu.plugin.versionCatalogUpdate import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension @@ -75,10 +76,8 @@ doctor { } dependencyAnalysis { - issues { - all { - ignoreKtx(true) - } + structure { + ignoreKtx(true) } } @@ -134,7 +133,7 @@ tasks { autoCorrect = false } - withType().configureEach { + withType().configureEach { outputFormatter = "json" fun stabilityLevel(version: String): Int { diff --git a/buildSrc/src/main/kotlin/ConfigureAndroid.kt b/buildSrc/src/main/kotlin/ConfigureAndroid.kt index 1ef44453..1dfd4a76 100644 --- a/buildSrc/src/main/kotlin/ConfigureAndroid.kt +++ b/buildSrc/src/main/kotlin/ConfigureAndroid.kt @@ -5,7 +5,7 @@ import com.android.build.gradle.LibraryExtension import org.gradle.api.Project fun Project.configureAndroid( - commonExtension: CommonExtension<*, *, *, *, *>, + commonExtension: CommonExtension<*, *, *, *, *, *>, ) = commonExtension.apply { compileSdk = Config.compileSdk val libs by versionCatalog diff --git a/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt b/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt index 16b90f1a..a5a336da 100644 --- a/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt +++ b/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt @@ -45,34 +45,32 @@ fun Project.configureMultiplatform( jvm() } - if (iOs) { - sequence { - if (iOs) { - yield(iosX64()) - yield(iosArm64()) - yield(iosSimulatorArm64()) - } - if (macOs) { - yield(macosArm64()) - yield(macosX64()) - } - if (tvOs) { - yield(tvosX64()) - yield(tvosArm64()) - yield(tvosSimulatorArm64()) - } - if (watchOs) { - yield(watchosX64()) - yield(watchosArm64()) - yield(watchosDeviceArm64()) - yield(watchosSimulatorArm64()) - } - }.forEach { - it.binaries.framework { - binaryOption("bundleId", Config.artifactId) - binaryOption("bundleVersion", Config.versionName) - baseName = Config.artifactId - } + sequence { + if (iOs) { + yield(iosX64()) + yield(iosArm64()) + yield(iosSimulatorArm64()) + } + if (macOs) { + yield(macosArm64()) + yield(macosX64()) + } + if (tvOs) { + yield(tvosX64()) + yield(tvosArm64()) + yield(tvosSimulatorArm64()) + } + if (watchOs) { + yield(watchosX64()) + yield(watchosArm64()) + yield(watchosDeviceArm64()) + yield(watchosSimulatorArm64()) + } + }.forEach { + it.binaries.framework { + binaryOption("bundleId", Config.artifactId) + binaryOption("bundleVersion", Config.versionName) + baseName = Config.artifactId } } diff --git a/buildSrc/src/main/kotlin/ConfigurePublication.kt b/buildSrc/src/main/kotlin/ConfigurePublication.kt index 238baf06..1c188e68 100644 --- a/buildSrc/src/main/kotlin/ConfigurePublication.kt +++ b/buildSrc/src/main/kotlin/ConfigurePublication.kt @@ -1,7 +1,6 @@ @file:Suppress("MissingPackageDeclaration", "unused") import com.android.build.api.dsl.LibraryExtension -import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties import com.android.build.gradle.tasks.BundleAar import org.gradle.api.Project import org.gradle.api.publish.PublishingExtension @@ -17,7 +16,7 @@ import org.gradle.plugins.signing.Sign * Configures Maven publishing to sonatype for this project */ fun Project.publishMultiplatform() { - val properties = gradleLocalProperties(rootDir) + val properties by localProperties val isReleaseBuild = properties["release"]?.toString().toBoolean() val javadocTask = tasks.named("emptyJavadocJar") // TODO: dokka does not support kmp javadocs yet @@ -52,7 +51,7 @@ fun Project.publishAndroid(ext: LibraryExtension) = with(ext) { } afterEvaluate { - val properties = gradleLocalProperties(rootDir) + val properties by localProperties val isReleaseBuild = properties["release"]?.toString().toBoolean() requireNotNull(extensions.findByType()).apply { diff --git a/buildSrc/src/main/kotlin/Util.kt b/buildSrc/src/main/kotlin/Util.kt index 48e56207..1b2eb1ef 100644 --- a/buildSrc/src/main/kotlin/Util.kt +++ b/buildSrc/src/main/kotlin/Util.kt @@ -10,7 +10,10 @@ import org.gradle.api.artifacts.VersionCatalog import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.kotlin.dsl.getByType import org.gradle.plugin.use.PluginDependency +import java.io.File +import java.io.FileInputStream import java.util.Base64 +import java.util.Properties /** * Load version catalog for usage in places where it is not available yet with gradle 7.x. @@ -50,3 +53,10 @@ fun List.toJavaArrayString() = buildString { } fun String.toBase64() = Base64.getEncoder().encodeToString(toByteArray()) + +val Project.localProperties + get() = lazy { + Properties().apply { + load(FileInputStream(File(rootProject.rootDir, "local.properties"))) + } + } From 4d864bb190b16026999fe05bd3e7c8695f8aa3e4 Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 13 Dec 2023 17:42:17 +0300 Subject: [PATCH 4/5] update deps --- gradle/libs.versions.toml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6d05761c..cd114190 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,16 +2,16 @@ activity = "1.8.1" compose = "1.5.4" compose-plugin = "1.5.11" -compose-compiler = "1.5.5" +compose-compiler = "1.5.6" composeDetektPlugin = "1.3.0" core-ktx = "1.12.0" coroutines = "1.7.3" -dependencyAnalysisPlugin = "1.26.0" -detekt = "1.23.3" -detektFormattingPlugin = "1.23.3" +dependencyAnalysisPlugin = "1.28.0" +detekt = "1.23.4" +detektFormattingPlugin = "1.23.4" dokka = "1.9.10" fragment = "1.6.2" -gradleAndroid = "8.2.0" +gradleAndroid = "8.3.0-alpha17" gradleDoctorPlugin = "0.9.1" junit = "4.13.2" koin = "3.5.0" @@ -19,7 +19,7 @@ koin-compose = "1.1.1-RC1" kotest = "5.8.0" kotest-plugin = "5.8.0" # @pin -kotlin = "1.9.20" +kotlin = "1.9.21" kotlinx-atomicfu = "0.23.1" lifecycle = "2.6.2" material = "1.10.0" @@ -48,8 +48,8 @@ dokka-android = { module = "org.jetbrains.dokka:android-documentation-plugin", v gradle-versions = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "versionsPlugin" } junit = { module = "junit:junit", version.ref = "junit" } koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } -koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" } koin-android-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin" } +koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" } koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } @@ -88,15 +88,15 @@ unittest = [ ] [plugins] -jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } androidApplication = { id = "com.android.application", version.ref = "gradleAndroid" } androidLibrary = { id = "com.android.library", version.ref = "gradleAndroid" } -kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } atomicfu = { id = "kotlinx-atomicfu", version.ref = "kotlinx-atomicfu" } dependencyAnalysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "dependencyAnalysisPlugin" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } gradleDoctor = { id = "com.osacky.doctor", version.ref = "gradleDoctorPlugin" } +jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } kotest = { id = "io.kotest.multiplatform", version.ref = "kotest-plugin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } version-catalog-update = { id = "nl.littlerobots.version-catalog-update", version.ref = "versionCatalogUpdatePlugin" } versions = { id = "com.github.ben-manes.versions", version.ref = "versionsPlugin" } From 01c0566ee56349d09d333204d1d5f6e680d59c00 Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 13 Dec 2023 18:16:11 +0300 Subject: [PATCH 5/5] bump version number --- buildSrc/src/main/kotlin/Config.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 80f1f8b4..7f479d3e 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -17,7 +17,7 @@ object Config { const val majorRelease = 2 const val minorRelease = 2 - const val patch = 0 + const val patch = 1 const val postfix = "rc" const val versionName = "$majorRelease.$minorRelease.$patch-$postfix" const val url = "https://github.com/respawn-app/FlowMVI"