Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 467dfec

Browse files
committedOct 31, 2023
Mini 4.0.0
Fix mini-processor-test Add rules for StateContainer
1 parent 82b8f76 commit 467dfec

File tree

29 files changed

+224
-91
lines changed

29 files changed

+224
-91
lines changed
 

‎.idea/kotlinc.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎CHANGELOG.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
### Security
1919
- No security issues fixed!
2020

21+
## [4.0.0] - 2023-10-31
22+
## 🎃🎃 Happy Halloween! 🎃🎃
23+
### Changed
24+
- BREAKING CHANGE: Mini has been updated to use Java 17 instead of Java 8.
25+
- BREAKING CHANGE: Mini states must now implement `mini.State`.
26+
- Update all project dependencies.
27+
- Update documentation.
28+
2129
## [3.1.0] - 2022-09-18
2230
### Added
2331
- Add **EXPERIMENTAL** support for Kotlin Symbol Processing (KSP). Be mindful of [the gotchas](README.md#ksp-gotchas).
@@ -174,7 +182,8 @@ state (`success` or `failure`)
174182
### Added
175183
- Initial architecture release.
176184

177-
[Unreleased]: https://github.com/hyperdevs-team/mini-kotlin/compare/3.1.0...HEAD
185+
[Unreleased]: https://github.com/hyperdevs-team/mini-kotlin/compare/4.0.0...HEAD
186+
[4.0.0]: https://github.com/hyperdevs-team/mini-kotlin/compare/3.1.0...4.0.0
178187
[3.1.0]: https://github.com/hyperdevs-team/mini-kotlin/compare/3.0.0...3.1.0
179188
[3.0.0]: https://github.com/hyperdevs-team/mini-kotlin/compare/2.0.0...3.0.0
180189
[2.0.0]: https://github.com/hyperdevs-team/mini-kotlin/compare/1.4.0...2.0.0

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ ksp("com.github.hyperdevs-team.mini-kotlin:mini-processor:${miniVersion}")
147147

148148
</details>
149149

150-
### JDK8 requirements
151-
Ensure that your project has compatibility with Java 8:
150+
### JDK
151+
Ensure that your project has compatibility with Java 17:
152152

153153
For Kotlin projects:
154154
```groovy
155155
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
156156
kotlinOptions {
157-
jvmTarget = "1.8"
157+
jvmTarget = "17"
158158
}
159159
}
160160
```
@@ -163,12 +163,12 @@ For Android:
163163
```groovy
164164
android {
165165
compileOptions {
166-
sourceCompatibility = JavaVersion.VERSION_1_8
167-
targetCompatibility = JavaVersion.VERSION_1_8
166+
sourceCompatibility = JavaVersion.VERSION_17
167+
targetCompatibility = JavaVersion.VERSION_17
168168
}
169169
170170
kotlinOptions {
171-
jvmTarget = "1.8"
171+
jvmTarget = "17"
172172
}
173173
}
174174
```

‎app/build.gradle‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ apply plugin: "kotlin-kapt"
2828
apply plugin: "com.google.devtools.ksp"
2929

3030
android {
31-
compileSdkVersion android_target_sdk
32-
buildToolsVersion android_build_tools_version
31+
compileSdk = android_target_sdk
32+
buildToolsVersion = android_build_tools_version
3333

3434
namespace "com.example.androidsample"
3535

@@ -55,19 +55,19 @@ android {
5555
}
5656

5757
compileOptions {
58-
sourceCompatibility JavaVersion.VERSION_1_8
59-
targetCompatibility JavaVersion.VERSION_1_8
58+
sourceCompatibility JavaVersion.VERSION_17
59+
targetCompatibility JavaVersion.VERSION_17
6060
}
6161

6262
kotlinOptions {
63-
jvmTarget = "1.8"
63+
jvmTarget = "17"
6464
}
6565
lint {
6666
abortOnError false
6767
}
6868

69-
configurations.all {
70-
//This is library is included with two different versions
69+
configurations.configureEach {
70+
//This library is included with two different versions
7171
resolutionStrategy.force "com.google.code.findbugs:jsr305:3.0.1"
7272
}
7373
}

‎app/src/main/java/com/example/androidsample/SampleActions.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import mini.Reducer
2121
import mini.SuspendingAction
2222
import java.io.Serializable
2323

24-
data class State(
24+
data class MainState(
2525
val text: String = "0",
2626
val loading: Boolean = false
27-
) : Serializable
27+
) : Serializable, mini.State
2828

2929
@Action
3030
data class SetLoadingAction(val loading: Boolean)

‎app/src/main/java/com/example/androidsample/StoreSampleActivity.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ import mini.android.FluxActivity
3030

3131
private val dispatcher = Dispatcher()
3232

33-
class MainStore : Store<State>() {
33+
class MainStore : Store<MainState>() {
3434

3535
init {
3636
Mini.link(dispatcher, this).track()
3737
}
3838

3939
@Reducer
40-
fun handleLoading(state: State, action: SetLoadingAction): State {
40+
fun handleLoading(state: MainState, action: SetLoadingAction): MainState {
4141
return state.copy(loading = action.loading)
4242
}
4343

4444
@Reducer
45-
fun handleSetTextAction(state: State, action: SetTextAction): State {
45+
fun handleSetTextAction(state: MainState, action: SetTextAction): MainState {
4646
return state.copy(text = action.text)
4747
}
4848

‎app/src/main/java/com/example/androidsample/ViewModelSampleActivity.kt‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,33 @@ import mini.android.FluxStoreViewModel
3232

3333
private val dispatcher = Dispatcher()
3434

35-
class MainViewModelReducer : NestedStateContainer<State>() {
35+
class MainViewModelReducer : NestedStateContainer<MainState>() {
3636

3737
@Reducer
38-
fun handleLoading(state: State, action: SetLoadingAction): State {
38+
fun handleLoading(state: MainState, action: SetLoadingAction): MainState {
3939
return state.copy(loading = action.loading)
4040
}
4141

4242
@Reducer
43-
fun handleSetTextAction(state: State, action: SetTextAction): State {
43+
fun handleSetTextAction(state: MainState, action: SetTextAction): MainState {
4444
return state.copy(text = action.text)
4545
}
4646
}
4747

48-
class MainStoreViewModel(savedStateHandle: SavedStateHandle) : FluxStoreViewModel<State>(savedStateHandle) {
48+
class MainStoreViewModel(savedStateHandle: SavedStateHandle) : FluxStoreViewModel<MainState>(savedStateHandle) {
4949
private val reducerSlice = MainViewModelReducer().apply { parent = this@MainStoreViewModel }
5050

5151
init {
5252
Mini.link(dispatcher, listOf(this, reducerSlice)).track()
5353
}
5454

55-
override fun saveState(state: State, handle: SavedStateHandle) {
55+
override fun saveState(state: MainState, handle: SavedStateHandle) {
5656
println("State saved")
5757
handle.set("state", state)
5858
}
5959

60-
override fun restoreState(handle: SavedStateHandle): State? {
61-
val restored = handle.get<State>("state")
60+
override fun restoreState(handle: SavedStateHandle): MainState? {
61+
val restored = handle.get<MainState>("state")
6262
println("State restored $restored")
6363
return restored
6464
}

‎build.gradle‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ apply plugin: "com.gladed.androidgitversion"
2121

2222
buildscript {
2323
ext {
24-
kotlin_version = "1.7.0"
24+
kotlin_version = "1.9.10"
2525

26-
android_compile_sdk = 33
27-
android_target_sdk = 33
28-
android_build_tools_version = "30.0.3"
26+
android_compile_sdk = 34
27+
android_target_sdk = 34
28+
android_build_tools_version = "34.0.0"
2929

30-
activity_version = "1.5.0"
31-
fragment_version = "1.5.0"
32-
lifecycle_version = "2.5.1"
33-
coroutines_version = "1.6.4"
30+
activity_version = "1.8.0"
31+
fragment_version = "1.6.1"
32+
lifecycle_version = "2.6.2"
33+
coroutines_version = "1.7.3"
3434

35-
kodein_version = "7.14.0"
35+
kodein_version = "7.20.2"
3636

3737
junit_version = "4.13.2"
38-
test_runner_version = "1.4.0"
39-
espresso_version = "3.4.0"
38+
test_runner_version = "1.5.2"
39+
espresso_version = "3.5.1"
4040
kluent_version = "1.68"
4141

42-
ksp_version = "${kotlin_version}-1.0.6"
42+
ksp_version = "${kotlin_version}-1.0.13"
4343
}
4444

4545
repositories {
@@ -49,11 +49,11 @@ buildscript {
4949
}
5050

5151
dependencies {
52-
classpath "com.android.tools.build:gradle:7.2.2"
52+
classpath "com.android.tools.build:gradle:8.1.2"
5353
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
5454
classpath "org.junit.platform:junit-platform-gradle-plugin:1.2.0"
5555
classpath "com.gladed.androidgitversion:gradle-android-git-version:0.4.14"
56-
classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0"
56+
classpath "com.github.ben-manes:gradle-versions-plugin:0.48.0"
5757
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$ksp_version"
5858
}
5959
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jul 08 11:00:27 CEST 2022
21
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
42
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
64
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

‎jitpack.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
jdk:
2-
- openjdk11
2+
- openjdk17

‎mini-android/build.gradle‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -20,8 +22,8 @@ apply plugin: "com.android.library"
2022
apply plugin: "kotlin-android"
2123

2224
android {
23-
compileSdkVersion android_compile_sdk
24-
buildToolsVersion android_build_tools_version
25+
compileSdk = android_compile_sdk
26+
buildToolsVersion = android_build_tools_version
2527

2628
namespace "mini.android"
2729

@@ -39,8 +41,16 @@ android {
3941
}
4042
}
4143

44+
compileOptions {
45+
sourceCompatibility JavaVersion.VERSION_17
46+
targetCompatibility JavaVersion.VERSION_17
47+
}
48+
}
49+
50+
tasks.withType(KotlinCompile).configureEach {
4251
kotlinOptions {
43-
jvmTarget = "1.8"
52+
jvmTarget = "17"
53+
4454
freeCompilerArgs += [
4555
"-opt-in=kotlin.Experimental",
4656
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
@@ -52,7 +62,7 @@ dependencies {
5262
api project(':mini-common')
5363

5464
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
55-
api "androidx.appcompat:appcompat:1.4.2"
65+
api "androidx.appcompat:appcompat:1.6.1"
5666
api "androidx.activity:activity-ktx:$activity_version"
5767
api "androidx.fragment:fragment-ktx:$fragment_version"
5868

‎mini-android/src/main/java/mini/android/FluxStoreViewModel.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ import androidx.lifecycle.SavedStateHandle
2020
import androidx.lifecycle.ViewModel
2121
import mini.CloseableTracker
2222
import mini.DefaultCloseableTracker
23+
import mini.State
2324
import mini.StateContainer
2425
import mini.assertOnUiThread
2526
import java.io.Closeable
2627
import java.util.concurrent.CopyOnWriteArrayList
2728

28-
abstract class FluxStoreViewModel<S : Any>(
29+
abstract class FluxStoreViewModel<S : State>(
2930
val savedStateHandle: SavedStateHandle) :
3031
ViewModel(),
3132
StateContainer<S>,

‎mini-common/build.gradle‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -16,12 +18,11 @@
1618
* limitations under the License.
1719
*/
1820

19-
apply plugin: 'kotlin'
2021
apply plugin: "kotlin"
2122
apply from: "../jitpack.gradle"
2223

2324
dependencies {
24-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
25+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
2526
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
2627

2728
// Optional Rx and Android bindings, one day these should be modules,
@@ -35,12 +36,20 @@ dependencies {
3536
testImplementation "org.amshove.kluent:kluent:$kluent_version"
3637
}
3738

38-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
39-
kotlinOptions.freeCompilerArgs += [
40-
"-opt-in=kotlin.Experimental",
41-
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
42-
"-opt-in=kotlinx.coroutines.FlowPreview",
43-
]
39+
tasks.withType(KotlinCompile).configureEach {
40+
kotlinOptions {
41+
jvmTarget = "17"
42+
43+
freeCompilerArgs += [
44+
"-opt-in=kotlin.Experimental",
45+
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
46+
"-opt-in=kotlinx.coroutines.FlowPreview"]
47+
}
48+
}
49+
50+
java {
51+
sourceCompatibility = JavaVersion.VERSION_17
52+
targetCompatibility = JavaVersion.VERSION_17
4453
}
4554

4655
apply plugin: "idea"

‎mini-common/src/main/java/mini/Mini.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ abstract class Mini {
7070
/**
7171
* Link all [Reducer] functions present in the store to the dispatcher.
7272
*/
73-
protected abstract fun <S> subscribe(dispatcher: Dispatcher, container: StateContainer<S>): Closeable
73+
protected abstract fun <S: State> subscribe(dispatcher: Dispatcher,
74+
container: StateContainer<S>): Closeable
7475

7576
/**
7677
* Link all [Reducer] functions present in the store to the dispatcher.

‎mini-common/src/main/java/mini/NestedStateContainer.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ import java.io.Closeable
4242
* }
4343
* ```
4444
*/
45-
abstract class NestedStateContainer<S : Any>(var parent: StateContainer<S>? = null) : StateContainer<S> {
45+
abstract class NestedStateContainer<S : State>(
46+
var parent: StateContainer<S>? = null
47+
) : StateContainer<S> {
4648
override val state: S
4749
get() = parent!!.state
4850

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2023 HyperDevs
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package mini
18+
19+
/**
20+
* Class that represents a state in the app.
21+
*
22+
* All state objects need to implement this interface.
23+
*/
24+
interface State {
25+
}

‎mini-common/src/main/java/mini/StateContainer.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ import java.lang.reflect.ParameterizedType
2323
/**
2424
* Common interface for state containers.
2525
*/
26-
interface StateContainer<S> {
26+
interface StateContainer<S : State> {
2727

2828
companion object {
2929
/**
3030
* Token to mark a state as not initialized.
3131
*/
32-
object NoState
32+
object NoState : State
3333
}
3434

3535
val state: S
@@ -51,7 +51,7 @@ interface StateContainer<S> {
5151
@Suppress("UNCHECKED_CAST")
5252
fun initialState(): S {
5353
val type = (javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0]
54-
as Class<S>
54+
as Class<S>
5555
try {
5656
val constructor = type.getDeclaredConstructor()
5757
constructor.isAccessible = true

‎mini-common/src/main/java/mini/Store.kt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ import java.util.concurrent.CopyOnWriteArrayList
2424
/**
2525
* Basic state holder.
2626
*/
27-
abstract class Store<S> : Closeable,
27+
abstract class Store<S : State> : Closeable,
2828
StateContainer<S>,
2929
CloseableTracker by DefaultCloseableTracker() {
3030

31-
class StoreSubscription internal constructor(private val store: Store<*>,
32-
private val fn: Any) : Closeable {
31+
class StoreSubscription<S : State> internal constructor(
32+
private val store: Store<S>,
33+
private val fn: Any
34+
) : Closeable {
3335
override fun close() {
3436
store.listeners.remove(fn)
3537
}

‎mini-common/src/main/java/mini/StoreFlow.kt‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fun Flow<Boolean>.onEachEnable(fn: (Boolean) -> Unit): Flow<Boolean> {
8383
*
8484
* @param hotStart emit current state when starting.
8585
*/
86-
fun <S : Any> StateContainer<S>.channel(hotStart: Boolean = true,
86+
fun <S : State> StateContainer<S>.channel(hotStart: Boolean = true,
8787
capacity: Int = Channel.BUFFERED): Channel<S> {
8888
val channel = Channel<S>(capacity)
8989
val subscription = subscribe(hotStart) {
@@ -101,7 +101,8 @@ fun <S : Any> StateContainer<S>.channel(hotStart: Boolean = true,
101101
*
102102
* @param hotStart emit current state when starting.
103103
*/
104-
fun <S : Any> StateContainer<S>.flow(hotStart: Boolean = true, capacity: Int = Channel.BUFFERED): Flow<S> {
104+
fun <S : State> StateContainer<S>.flow(hotStart: Boolean = true,
105+
capacity: Int = Channel.BUFFERED): Flow<S> {
105106
return channel(hotStart = hotStart, capacity = capacity).receiveAsFlow()
106107
}
107108

@@ -118,20 +119,24 @@ class StateMerger<T> {
118119
val containersAndMappers = ArrayList<Pair<StateContainer<*>, () -> T>>()
119120

120121
/** Add a new store + mapper to the flowable. */
121-
inline fun <S : StateContainer<U>, U : Any> merge(stateContainer: S, crossinline mapper: (U.() -> T)) {
122+
inline fun <S : StateContainer<U>, U : State> merge(stateContainer: S,
123+
crossinline mapper: (U.() -> T)) {
122124
containersAndMappers.add(stateContainer to { stateContainer.state.mapper() })
123125
}
124126
}
125127

126-
inline fun <T> mergeStates(hotStart: Boolean = true, crossinline builder: StateMerger<T>.() -> Unit): Flow<List<T>> {
128+
inline fun <T> mergeStates(hotStart: Boolean = true,
129+
crossinline builder: StateMerger<T>.() -> Unit): Flow<List<T>> {
127130
return StateMerger<T>().apply { builder() }.flow(hotStart)
128131
}
129132

130133
/** Build the StateMerger into the final flowable. */
131134
@Suppress("UNCHECKED_CAST")
132135
fun <T> StateMerger<T>.flow(hotStart: Boolean = true) : Flow<List<T>> {
133136
return containersAndMappers
134-
.map { (stateContainer, fn) -> (stateContainer as StateContainer<Any>).flow(hotStart).select { fn() } }
137+
.map { (stateContainer, fn) ->
138+
(stateContainer as StateContainer<State>).flow(hotStart).select { fn() }
139+
}
135140
.reduce { acc, flow -> merge(acc, flow) }
136141
.map { containersAndMappers.map { (_, fn) -> fn() }.toList() }
137142
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
-keep class mini.codegen.** { *; }
22

33
-keepnames class * extends mini.Store { *; }
4+
-keepnames class * extends mini.State { *; }
5+
-keepnames @mini.Action class * { *; }
46

57
-keep class mini.Action
68
-keep @mini.Action class * { *; }
79

8-
-keep class mini.Resource { *; }
10+
-keep class mini.Resource { *; }
11+
12+
-keep class mini.State { *; }
13+
-keep class * implements mini.State { *; }
14+
15+
-keep class mini.StateContainer { *; }
16+
-keep class * implements mini.StateContainer { *; }

‎mini-kodein-android-compose/build.gradle‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -36,19 +38,23 @@ android {
3638
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
3739
}
3840
}
41+
3942
compileOptions {
40-
sourceCompatibility JavaVersion.VERSION_1_8
41-
targetCompatibility JavaVersion.VERSION_1_8
43+
sourceCompatibility JavaVersion.VERSION_17
44+
targetCompatibility JavaVersion.VERSION_17
4245
}
46+
}
47+
48+
tasks.withType(KotlinCompile).configureEach {
4349
kotlinOptions {
44-
jvmTarget = '1.8'
50+
jvmTarget = "17"
4551
}
4652
}
4753

4854
dependencies {
4955
api project(':mini-kodein-android')
5056

51-
api "androidx.navigation:navigation-compose:2.5.2"
57+
api "androidx.navigation:navigation-compose:2.7.4"
5258

5359
testImplementation "junit:junit:$junit_version"
5460
androidTestImplementation "androidx.test:runner:$test_runner_version"

‎mini-kodein-android/build.gradle‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -40,12 +42,14 @@ android {
4042
}
4143

4244
compileOptions {
43-
sourceCompatibility = JavaVersion.VERSION_1_8
44-
targetCompatibility = JavaVersion.VERSION_1_8
45+
sourceCompatibility JavaVersion.VERSION_17
46+
targetCompatibility JavaVersion.VERSION_17
4547
}
48+
}
4649

50+
tasks.withType(KotlinCompile).configureEach {
4751
kotlinOptions {
48-
jvmTarget = "1.8"
52+
jvmTarget = "17"
4953
}
5054
}
5155

‎mini-kodein/build.gradle‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
apply plugin: "kotlin"
24
apply plugin: "java-library"
35
apply from: "../jitpack.gradle"
@@ -21,15 +23,20 @@ apply from: "../jitpack.gradle"
2123
*/
2224

2325
// Needed because of the Kodein dependency.
24-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
26+
tasks.withType(KotlinCompile).configureEach {
2527
kotlinOptions {
26-
jvmTarget = "1.8"
28+
jvmTarget = "17"
2729
}
2830
}
2931

32+
java {
33+
sourceCompatibility = JavaVersion.VERSION_17
34+
targetCompatibility = JavaVersion.VERSION_17
35+
}
36+
3037
dependencies {
3138
api project(':mini-common')
32-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
39+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
3340
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
3441

3542
api "org.kodein.di:kodein-di-jvm:$kodein_version"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-keep, allowobfuscation, allowoptimization class org.kodein.type.TypeReference
2+
-keep, allowobfuscation, allowoptimization class org.kodein.type.JVMAbstractTypeToken$Companion$WrappingTest
3+
-keep, allowobfuscation, allowoptimization class * extends org.kodein.type.TypeReference
4+
-keep, allowobfuscation, allowoptimization class * extends org.kodein.type.JVMAbstractTypeToken$Companion$WrappingTest

‎mini-processor-test/build.gradle‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -29,8 +31,13 @@ dependencies {
2931
testImplementation "org.amshove.kluent:kluent:$kluent_version"
3032
}
3133

32-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
34+
tasks.withType(KotlinCompile).configureEach {
3335
kotlinOptions {
34-
jvmTarget = "1.8"
36+
jvmTarget = "17"
3537
}
38+
}
39+
40+
java {
41+
sourceCompatibility = JavaVersion.VERSION_17
42+
targetCompatibility = JavaVersion.VERSION_17
3643
}

‎mini-processor-test/src/main/java/mini/test/BasicState.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@
1616

1717
package mini.test
1818

19-
data class BasicState(val value: String = "initial")
19+
import mini.State
20+
21+
data class BasicState(val value: String = "initial") : State

‎mini-processor/build.gradle‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -21,15 +23,15 @@ apply plugin: "kotlin-kapt"
2123
apply from: "../jitpack.gradle"
2224

2325
ext {
24-
kotlinpoet_version = "1.12.0"
25-
auto_version = "1.2.1"
26-
incap_version = "0.3"
27-
google_testing_version = "0.19"
26+
kotlinpoet_version = "1.14.2"
27+
auto_version = "1.2.2"
28+
incap_version = "1.0.0"
29+
google_testing_version = "0.21.0"
2830
}
2931

3032
dependencies {
3133
api project(':mini-common')
32-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
34+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
3335
implementation "com.squareup:kotlinpoet:$kotlinpoet_version"
3436
implementation "com.squareup:kotlinpoet-ksp:$kotlinpoet_version"
3537

@@ -43,4 +45,15 @@ dependencies {
4345
testImplementation "com.google.testing.compile:compile-testing:$google_testing_version"
4446

4547
implementation "com.google.devtools.ksp:symbol-processing-api:$ksp_version"
48+
}
49+
50+
tasks.withType(KotlinCompile).configureEach {
51+
kotlinOptions {
52+
jvmTarget = "17"
53+
}
54+
}
55+
56+
java {
57+
sourceCompatibility = JavaVersion.VERSION_17
58+
targetCompatibility = JavaVersion.VERSION_17
4659
}

‎mini-processor/src/main/java/mini/processor/common/reducers/ReducersGenerator.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ReducersGenerator(private val delegate: ReducersGeneratorDelegate) {
5050
.addStatement("return c")
5151
.build()
5252

53-
val typeParam = TypeVariableName("T")
53+
val typeParam = TypeVariableName("T", ClassName("mini", "State"))
5454
val oneParam = StateContainer::class.asTypeName().parameterizedBy(typeParam)
5555

5656
val registerOneFn = FunSpec.builder("subscribe")

‎mini-testing/build.gradle‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2021 HyperDevs
35
*
@@ -21,8 +23,19 @@ apply from: "../jitpack.gradle"
2123

2224
dependencies {
2325
api project(':mini-common')
24-
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
26+
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
2527
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
2628

2729
api "junit:junit:$junit_version"
30+
}
31+
32+
tasks.withType(KotlinCompile).configureEach {
33+
kotlinOptions {
34+
jvmTarget = "17"
35+
}
36+
}
37+
38+
java {
39+
sourceCompatibility = JavaVersion.VERSION_17
40+
targetCompatibility = JavaVersion.VERSION_17
2841
}

0 commit comments

Comments
 (0)
Please sign in to comment.