From ea6c33b497174385da81c3487df5392fbb4347dc Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 4 Sep 2021 14:20:35 +0600 Subject: [PATCH 1/4] start 0.5.24 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2860bd4a4d6..3a681f15d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.5.24 + ## 0.5.23 * `Versions`: diff --git a/gradle.properties b/gradle.properties index 09c465ae2d1..bc501e0afe9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,5 +45,5 @@ dokka_version=1.5.0 # Project data group=dev.inmo -version=0.5.23 -android_code_version=64 +version=0.5.24 +android_code_version=65 From bd9b0d16abb2daa309a46d41512b606f06df7467 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 4 Sep 2021 14:34:27 +0600 Subject: [PATCH 2/4] update dependencies --- CHANGELOG.md | 4 ++++ gradle.properties | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a681f15d3d..0246de47656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.5.24 +* `Versions`: + * `Coroutines`: `1.5.1` -> `1.5.2` + * `Klock`: `2.3.4` -> `2.4.1` + ## 0.5.23 * `Versions`: diff --git a/gradle.properties b/gradle.properties index bc501e0afe9..0bb6ea64dc4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,13 +8,13 @@ android.enableJetifier=true org.gradle.jvmargs=-Xmx2g kotlin_version=1.5.30 -kotlin_coroutines_version=1.5.1 +kotlin_coroutines_version=1.5.2 kotlin_serialisation_core_version=1.2.2 kotlin_exposed_version=0.34.1 ktor_version=1.6.3 -klockVersion=2.3.4 +klockVersion=2.4.1 github_release_plugin_version=2.2.12 From eed7cfdc427634ea18aa97c997675e23fa94b8f8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 4 Sep 2021 14:46:12 +0600 Subject: [PATCH 3/4] CoroutineScope with safely handler parameter --- CHANGELOG.md | 2 ++ .../dev/inmo/micro_utils/coroutines/HandleSafely.kt | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0246de47656..4c8f38e77cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ * `Versions`: * `Coroutines`: `1.5.1` -> `1.5.2` * `Klock`: `2.3.4` -> `2.4.1` +* `Coroutines`: + * New function `CoroutineScope` with safely exceptions handler as second parameter ## 0.5.23 diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt index 8fb0d3ad3f9..92f43522de7 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt @@ -39,9 +39,11 @@ object ContextSafelyExceptionHandlerKey : CoroutineContext.Key -) : CoroutineContext.Element { +) : CoroutineContext.Element, CoroutineExceptionHandler { override val key: CoroutineContext.Key<*> get() = ContextSafelyExceptionHandlerKey + + override fun handleException(context: CoroutineContext, exception: Throwable) = handler(exception) } /** @@ -147,3 +149,10 @@ suspend inline fun runCatchingSafelyWithoutExceptions( ): Result = runCatching { safelyWithoutExceptions(onException, block) } + +suspend inline fun CoroutineScope( + context: CoroutineContext, + defaultExceptionsHandler: ExceptionHandler +) = CoroutineScope( + context + ContextSafelyExceptionHandler(defaultExceptionsHandler) +) From c9bbfa38206e78bdafbc5e6e4a841a93348e4f1c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 4 Sep 2021 14:58:15 +0600 Subject: [PATCH 4/4] update gradle config and fix build --- .../dev/inmo/micro_utils/coroutines/HandleSafely.kt | 8 +++----- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt index 92f43522de7..bc662e79086 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt @@ -39,11 +39,9 @@ object ContextSafelyExceptionHandlerKey : CoroutineContext.Key -) : CoroutineContext.Element, CoroutineExceptionHandler { +) : CoroutineContext.Element { override val key: CoroutineContext.Key<*> get() = ContextSafelyExceptionHandlerKey - - override fun handleException(context: CoroutineContext, exception: Throwable) = handler(exception) } /** @@ -150,9 +148,9 @@ suspend inline fun runCatchingSafelyWithoutExceptions( safelyWithoutExceptions(onException, block) } -suspend inline fun CoroutineScope( +inline fun CoroutineScope( context: CoroutineContext, - defaultExceptionsHandler: ExceptionHandler + noinline defaultExceptionsHandler: ExceptionHandler ) = CoroutineScope( context + ContextSafelyExceptionHandler(defaultExceptionsHandler) ) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 05679dc3c18..ffed3a254e9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists