Skip to content

Kotlin 1.9.10, AGP 8.1.2, Ktlint 1.0.0, Kotlinx-Kover, SDK 34, and others ❤️ #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
root = true

root=true
[*]
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

indent_size=2
end_of_line=lf
charset=utf-8
trim_trailing_whitespace=true
insert_final_newline=true
[*.{kt,kts}]
ij_kotlin_imports_layout = *

ij_kotlin_imports_layout=*
ij_continuation_indent_size=4
ktlint_standard_filename=disabled
ktlint_standard_package-name=disabled
ktlint_standard_property-naming=disabled
ktlint_standard_function-naming=disabled
ktlint_standard_no-empty-file=disabled
filename=disabled
ktlint_experimental=enabled
[*.xml]
indent_size = 4
indent_size=4
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Cache gradle, wrapper and buildSrc
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-versions-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Cache gradle, wrapper and buildSrc
uses: actions/cache@v3
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: JetBrains/qodana-action@v2022.3.4
with:
linter: jetbrains/qodana-jvm-android:latest
fail-threshold: 10

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ runner.temp }}/qodana/results/report
destination_dir: ./
# - name: Set up JDK
# uses: actions/setup-java@v3
# with:
# distribution: 'zulu'
# java-version: '11'

# - uses: JetBrains/qodana-action@v2023.2.6
# with:
# linter: jetbrains/qodana-jvm-android:latest
# fail-threshold: 10
# upload-result: true
2 changes: 1 addition & 1 deletion .github/workflows/review-suggest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Cache gradle, wrapper and buildSrc
uses: actions/cache@v3
with:
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Cache gradle, wrapper and buildSrc
uses: actions/cache@v3
Expand All @@ -38,10 +38,7 @@ jobs:
run: chmod +x ./gradlew

- name: Run Android Debug Unit Test
run: ./gradlew jacocoTestReportDebug --warning-mode all --stacktrace

- name: Run Java/Kotlin Unit Test
run: ./gradlew jacocoTestReport --warning-mode all --stacktrace
run: ./gradlew :app:koverHtmlReport --warning-mode all --stacktrace

- name: Upload Test Report
uses: codecov/codecov-action@v3.1.4
4 changes: 1 addition & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[![Qodana](https://github.com/Kotlin-Android-Open-Source/MVI-Coroutines-Flow/actions/workflows/qodana.yml/badge.svg)](https://github.com/Kotlin-Android-Open-Source/MVI-Coroutines-Flow/actions/workflows/qodana.yml)
[![Validate Gradle Wrapper](https://github.com/Kotlin-Android-Open-Source/MVI-Coroutines-Flow/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/Kotlin-Android-Open-Source/MVI-Coroutines-Flow/actions/workflows/gradle-wrapper-validation.yml)
[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FKotlin-Android-Open-Source%2FMVI-Coroutines-Flow&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)
[![Gitter](https://badges.gitter.im/Kotlin-Android-Open-Source/community.svg)](https://gitter.im/Kotlin-Android-Open-Source/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Expand Down
53 changes: 46 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
androidApplication
kotlinAndroid
jacoco
id("org.jetbrains.kotlinx.kover")
}

android {
Expand All @@ -25,7 +25,7 @@ android {
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}

Expand All @@ -39,7 +39,11 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() }
buildFeatures { viewBinding = true }

buildFeatures {
viewBinding = true
buildConfig = true
}

testOptions {
unitTests.isIncludeAndroidResources = true
Expand All @@ -52,9 +56,9 @@ dependencies {
fileTree(
mapOf(
"dir" to "libs",
"include" to listOf("*.jar")
)
)
"include" to listOf("*.jar"),
),
),
)

implementation(domain)
Expand All @@ -77,10 +81,45 @@ dependencies {
testImplementation(deps.test.junit)
androidTestImplementation(deps.test.androidx.junit)
androidTestImplementation(deps.test.androidx.core)
androidTestImplementation(deps.test.androidx.espresso.core)
androidTestImplementation(
deps
.test
.androidx
.espresso
.core,
)

addUnitTest()
testImplementation(testUtils)
testImplementation(deps.koin.testJunit4)
testImplementation(deps.koin.test)
}

dependencies {
kover(project(":feature-main"))
kover(project(":feature-add"))
kover(project(":feature-search"))
kover(project(":domain"))
kover(project(":data"))
kover(project(":core"))
kover(project(":core-ui"))
kover(project(":mvi-base"))
}

koverReport {
// filters for all report types of all build variants
filters {
excludes {
classes(
"*.databinding.*",
"*.BuildConfig",
)
}
}

defaults {
// Tests, sources, classes, and compilation tasks of the 'debug' build variant will be included in the default report.
// Thus, information from the 'app1AppDebug' variant will be included in the default report for this project and any project that specifies this project as a dependency.
mergeWith("debug") // or the name of any build variant needed
}
}
17 changes: 9 additions & 8 deletions app/src/main/java/com/hoc/flowmvi/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import org.koin.core.logger.Level
@ExperimentalStdlibApi
@ExperimentalTime
@JvmField
val allModules = listOf(
coreModule,
dataModule,
domainModule,
mainModule,
addModule,
searchModule,
)
val allModules =
listOf(
coreModule,
dataModule,
domainModule,
mainModule,
addModule,
searchModule,
)

@Suppress("unused")
@ExperimentalStdlibApi
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/hoc/flowmvi/core/CoreModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import org.koin.core.module.dsl.singleOf
import org.koin.dsl.module

@JvmField
val coreModule = module {
singleOf(::DefaultAppCoroutineDispatchers) { bind<AppCoroutineDispatchers>() }
val coreModule =
module {
singleOf(::DefaultAppCoroutineDispatchers) { bind<AppCoroutineDispatchers>() }

singleOf(::NavigatorImpl) { bind<Navigator>() }
}
singleOf(::NavigatorImpl) { bind<Navigator>() }
}
3 changes: 1 addition & 2 deletions app/src/main/java/com/hoc/flowmvi/core/NavigatorImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class NavigatorImpl(
private val add: IntentProviders.Add,
private val search: IntentProviders.Search,
) : Navigator {
override fun Context.navigateToAdd() =
startActivity(add.makeIntent(this))
override fun Context.navigateToAdd() = startActivity(add.makeIntent(this))

override fun Context.navigateToSearch() {
startActivity(search.makeIntent(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ class ViewBindingInitializer : Initializer<Unit> {
Timber.d("ViewBindingInitializer...")
}

override fun dependencies(): List<Class<out Initializer<*>>> =
listOf(TimberInitializer::class.java)
override fun dependencies(): List<Class<out Initializer<*>>> = listOf(TimberInitializer::class.java)
}
17 changes: 9 additions & 8 deletions app/src/test/java/com/hoc/flowmvi/CheckModulesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ import org.koin.test.mock.MockProviderRule
@ExperimentalTime
class CheckModulesTest : AutoCloseKoinTest() {
@get:Rule
val mockProvider = MockProviderRule.create { clazz ->
when (clazz) {
SavedStateHandle::class -> {
mockk<SavedStateHandle> {
every { get<Any?>(any()) } returns null
every { setSavedStateProvider(any(), any()) } just runs
val mockProvider =
MockProviderRule.create { clazz ->
when (clazz) {
SavedStateHandle::class -> {
mockk<SavedStateHandle> {
every { get<Any?>(any()) } returns null
every { setSavedStateProvider(any(), any()) } just runs
}
}
else -> error("Unknown class: $clazz")
}
else -> error("Unknown class: $clazz")
}
}

@get:Rule
val coroutineRule = TestCoroutineDispatcherRule()
Expand Down
Loading