File tree Expand file tree Collapse file tree 5 files changed +33
-10
lines changed
src/main/kotlin/ru/nsk/kstatemachine Expand file tree Collapse file tree 5 files changed +33
-10
lines changed Original file line number Diff line number Diff line change 3
3
![ Build and test with Gradle] ( https://github.com/nsk90/kstatemachine/workflows/Build%20and%20test%20with%20Gradle/badge.svg )
4
4
[ ![ Quality Gate Status] ( https://sonarcloud.io/api/project_badges/measure?project=nsk90_kstatemachine&metric=alert_status )] ( https://sonarcloud.io/dashboard?id=nsk90_kstatemachine )
5
5
[ ![ ] ( https://jitpack.io/v/nsk90/kstatemachine.svg )] ( https://jitpack.io/#nsk90/kstatemachine )
6
+ ![ Maven Central] ( https://img.shields.io/maven-central/v/io.github.nsk90/kstatemachine )
6
7
![ Dependencies none] ( https://img.shields.io/badge/dependencies-none-green )
7
8
[ ![ codecov] ( https://codecov.io/gh/nsk90/kstatemachine/branch/master/graph/badge.svg?token=IR2JR43FOZ )] ( https://codecov.io/gh/nsk90/kstatemachine )
8
9
[ ![ Android Arsenal] ( https://img.shields.io/badge/Android%20Arsenal-KStateMachine-green.svg?style=flat )] ( https://android-arsenal.com/details/1/8276 )
@@ -17,6 +18,7 @@ Main features are:
17
18
18
19
* Zero dependency. It is written in pure Kotlin, it does not depend on any other libraries or Android SDK
19
20
* Kotlin DSL syntax for defining state machine structure. Using without DSL is also possible
21
+ * Backward compatible till Kotlin 1.4
20
22
* Event based - transitions are performed by processing incoming events
21
23
* Listeners for machine, states and transitions, all callbacks are shipped with information about current transition
22
24
* [ Guarded] ( https://github.com/nsk90/kstatemachine/wiki#guarded-transitions )
Original file line number Diff line number Diff line change 1
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2
-
3
1
plugins {
4
2
`kotlin- dsl`
5
3
}
@@ -8,10 +6,6 @@ repositories {
8
6
mavenCentral()
9
7
}
10
8
11
- tasks.withType<KotlinCompile > {
12
- kotlinOptions.jvmTarget = " 1.8"
13
- }
14
-
15
9
java {
16
10
sourceCompatibility = JavaVersion .VERSION_1_8
17
11
targetCompatibility = JavaVersion .VERSION_1_8
Original file line number Diff line number Diff line change 1
1
object Versions {
2
- const val kotlin = " 1.6.10"
2
+ // tools
3
+ const val kotlin = " 1.7.10"
3
4
const val gradle = " 7.1.0"
4
5
6
+ // compatibility
7
+ const val jvmTarget = " 1.8"
8
+ const val languageVersion = " 1.4"
9
+ const val apiVersion = " 1.4"
10
+
5
11
// dependencies
6
- const val mockk = " 1.12.2 "
7
- const val kotestAssertions = " 5.1 .0"
8
- const val kotestRunner = " 5.1 .0"
12
+ const val mockk = " 1.12.5 "
13
+ const val kotestAssertions = " 5.4 .0"
14
+ const val kotestRunner = " 5.4 .0"
9
15
}
Original file line number Diff line number Diff line change @@ -13,6 +13,16 @@ tasks.test {
13
13
useJUnitPlatform()
14
14
}
15
15
16
+ tasks {
17
+ compileKotlin {
18
+ kotlinOptions {
19
+ jvmTarget = Versions .jvmTarget
20
+ languageVersion = Versions .languageVersion
21
+ apiVersion = Versions .apiVersion
22
+ }
23
+ }
24
+ }
25
+
16
26
dependencies {
17
27
testImplementation(" io.kotest:kotest-assertions-core:${Versions .kotestAssertions} " )
18
28
testImplementation(" io.kotest:kotest-runner-junit5:${Versions .kotestRunner} " )
Original file line number Diff line number Diff line change
1
+ package ru.nsk.kstatemachine
2
+
3
+ internal inline fun <T , R : Any > Iterable<T>.firstNotNullOfOrNull (transform : (T ) -> R ? ): R ? {
4
+ for (element in this ) {
5
+ val result = transform(element)
6
+ if (result != null ) {
7
+ return result
8
+ }
9
+ }
10
+ return null
11
+ }
You can’t perform that action at this time.
0 commit comments