From 71f9a505e0095990134be032f1b268793810ea0a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 11 Jun 2021 17:03:20 +0600 Subject: [PATCH 1/3] start 0.5.8 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c9c34c0ed3..bc10814a619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.5.8 + ## 0.5.7 * `Pagination` diff --git a/gradle.properties b/gradle.properties index 70bf502ed43..c71491698b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,5 +45,5 @@ dokka_version=1.4.32 # Project data group=dev.inmo -version=0.5.7 -android_code_version=48 +version=0.5.8 +android_code_version=49 From 24033e0cac6638bd848f18c6f493e653ba81bec9 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 11 Jun 2021 17:32:13 +0600 Subject: [PATCH 2/3] firstNotNull and LinkedSupervisor(Job|Scope) --- CHANGELOG.md | 7 +++++++ .../micro_utils/common/IterableFirstNotNull.kt | 3 +++ .../micro_utils/coroutines/FlowFirstNotNull.kt | 6 ++++++ .../micro_utils/coroutines/SupervisorJob.kt | 17 +++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 common/src/commonMain/kotlin/dev/inmo/micro_utils/common/IterableFirstNotNull.kt create mode 100644 coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowFirstNotNull.kt create mode 100644 coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SupervisorJob.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index bc10814a619..3c155a10ae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## 0.5.8 +* `Common`: + * New extension `Iterable#firstNotNull` +* `Coroutines` + * New extension `Flow#firstNotNull` + * New extensions `CoroutineContext#LinkedSupervisorJob`, `CoroutineScope#LinkedSupervisorJob` and + `CoroutineScope#LinkedSupervisorScope` + ## 0.5.7 * `Pagination` diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/IterableFirstNotNull.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/IterableFirstNotNull.kt new file mode 100644 index 00000000000..b26717d77ac --- /dev/null +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/IterableFirstNotNull.kt @@ -0,0 +1,3 @@ +package dev.inmo.micro_utils.common + +fun Iterable.firstNotNull() = first { it != null }!! diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowFirstNotNull.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowFirstNotNull.kt new file mode 100644 index 00000000000..7626f7757ed --- /dev/null +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowFirstNotNull.kt @@ -0,0 +1,6 @@ +package dev.inmo.micro_utils.coroutines + +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.first + +suspend fun Flow.firstNotNull() = first { it != null }!! diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SupervisorJob.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SupervisorJob.kt new file mode 100644 index 00000000000..df4131ddecd --- /dev/null +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SupervisorJob.kt @@ -0,0 +1,17 @@ +package dev.inmo.micro_utils.coroutines + +import kotlinx.coroutines.* +import kotlin.coroutines.CoroutineContext + +fun CoroutineContext.LinkedSupervisorJob( + additionalContext: CoroutineContext? = null +) = SupervisorJob(job).let { if (additionalContext != null) it + additionalContext else it } +fun CoroutineScope.LinkedSupervisorJob( + additionalContext: CoroutineContext? = null +) = coroutineContext.LinkedSupervisorJob(additionalContext) + +fun CoroutineScope.LinkedSupervisorScope( + additionalContext: CoroutineContext? = null +) = CoroutineScope( + coroutineContext + LinkedSupervisorJob(additionalContext) +) From eb959a3135eebcffff934c336dfeae40c82db53b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 11 Jun 2021 22:33:08 +0600 Subject: [PATCH 3/3] add regular build workflow --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..c2c5d194e1c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,12 @@ +name: Regular build +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build + run: ./gradlew build