Skip to content

Commit c04e62c

Browse files
committed
Update Kotlin to 1.7.10 and turn on compatibility mode till Kotlin 1.4
This requires kotest to be updated to 5.4.0. Add maven central version badge.
1 parent 38fe6da commit c04e62c

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
![Build and test with Gradle](https://github.com/nsk90/kstatemachine/workflows/Build%20and%20test%20with%20Gradle/badge.svg)
44
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nsk90_kstatemachine&metric=alert_status)](https://sonarcloud.io/dashboard?id=nsk90_kstatemachine)
55
[![](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)
67
![Dependencies none](https://img.shields.io/badge/dependencies-none-green)
78
[![codecov](https://codecov.io/gh/nsk90/kstatemachine/branch/master/graph/badge.svg?token=IR2JR43FOZ)](https://codecov.io/gh/nsk90/kstatemachine)
89
[![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:
1718

1819
* Zero dependency. It is written in pure Kotlin, it does not depend on any other libraries or Android SDK
1920
* Kotlin DSL syntax for defining state machine structure. Using without DSL is also possible
21+
* Backward compatible till Kotlin 1.4
2022
* Event based - transitions are performed by processing incoming events
2123
* Listeners for machine, states and transitions, all callbacks are shipped with information about current transition
2224
* [Guarded](https://github.com/nsk90/kstatemachine/wiki#guarded-transitions)

buildSrc/build.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
plugins {
42
`kotlin-dsl`
53
}
@@ -8,10 +6,6 @@ repositories {
86
mavenCentral()
97
}
108

11-
tasks.withType<KotlinCompile> {
12-
kotlinOptions.jvmTarget = "1.8"
13-
}
14-
159
java {
1610
sourceCompatibility = JavaVersion.VERSION_1_8
1711
targetCompatibility = JavaVersion.VERSION_1_8
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
object Versions {
2-
const val kotlin = "1.6.10"
2+
// tools
3+
const val kotlin = "1.7.10"
34
const val gradle = "7.1.0"
45

6+
// compatibility
7+
const val jvmTarget = "1.8"
8+
const val languageVersion = "1.4"
9+
const val apiVersion = "1.4"
10+
511
// 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"
915
}

kstatemachine/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ tasks.test {
1313
useJUnitPlatform()
1414
}
1515

16+
tasks {
17+
compileKotlin {
18+
kotlinOptions {
19+
jvmTarget = Versions.jvmTarget
20+
languageVersion = Versions.languageVersion
21+
apiVersion = Versions.apiVersion
22+
}
23+
}
24+
}
25+
1626
dependencies {
1727
testImplementation("io.kotest:kotest-assertions-core:${Versions.kotestAssertions}")
1828
testImplementation("io.kotest:kotest-runner-junit5:${Versions.kotestRunner}")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
}

0 commit comments

Comments
 (0)