Migrate to kotlin 2.0

This commit is contained in:
Shinokuni 2024-08-05 23:28:04 +02:00
parent 152117d3bf
commit 4b80cfd1c1
7 changed files with 32 additions and 22 deletions

2
.gitignore vendored
View File

@ -135,3 +135,5 @@ Gemfile
mapping/
**/*.exec
.kotlin/

View File

@ -31,8 +31,9 @@ dependencies {
implementation(libs.coroutines.core)
testImplementation(libs.coroutines.test)
implementation(platform(libs.koin.bom))
implementation(libs.bundles.koin)
testImplementation(libs.bundles.kointest)
androidTestImplementation(libs.bundles.kointest)
implementation(libs.konsumexml)
implementation(libs.kotlinxmlbuilder)

View File

@ -1,6 +1,7 @@
plugins {
id("com.android.application")
kotlin("android")
alias(libs.plugins.compose.compiler)
id("com.mikepenz.aboutlibraries.plugin")
}
@ -25,8 +26,10 @@ android {
isMinifyEnabled = false
isShrinkResources = false
isTestCoverageEnabled = true
applicationIdSuffix = ".debug"
enableUnitTestCoverage = true
enableAndroidTestCoverage = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
@ -36,10 +39,6 @@ android {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
lint {
abortOnError = false
}
@ -78,8 +77,12 @@ dependencies {
implementation(libs.bundles.room)
implementation(libs.bundles.paging)
implementation(platform(libs.koin.bom))
implementation(libs.bundles.koin)
androidTestImplementation(libs.bundles.kointest)
//androidTestImplementation(libs.bundles.kointest)
// I don't know why but those dependencies are unreachable when accessed directly from version catalog
androidTestImplementation("io.insert-koin:koin-test:${libs.versions.koin.bom.get()}")
androidTestImplementation("io.insert-koin:koin-test-junit4:${libs.versions.koin.bom.get()}")
androidTestImplementation(libs.okhttp.mockserver)

View File

@ -1,8 +1,10 @@
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
buildscript {
repositories {
@ -21,6 +23,7 @@ buildscript {
plugins {
alias(libs.plugins.ksp) apply false
alias(libs.plugins.compose.compiler) apply false
}
allprojects {
@ -35,9 +38,9 @@ allprojects {
subprojects {
afterEvaluate {
tasks.withType<KotlinJvmCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
with(extensions.getByType<KotlinAndroidProjectExtension>()) {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}
@ -81,7 +84,7 @@ fun configure(extension: BaseExtension) = with(extension) {
}
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
/*jacoco {

View File

@ -42,8 +42,9 @@ dependencies {
implementation(libs.bundles.paging)
implementation(platform(libs.koin.bom))
implementation(libs.bundles.koin)
testImplementation(libs.bundles.kointest)
androidTestImplementation(libs.bundles.kointest)
implementation(libs.bundles.coroutines)
androidTestImplementation(libs.coroutines.test)

View File

@ -1,9 +1,8 @@
[versions]
kotlin = "1.9.10"
ksp = "1.9.10-1.0.13"
android_agp = "8.1.4"
compose_compiler = "1.5.3"
compose_bom = "2024.02.02"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.24"
android_agp = "8.5.1"
compose_bom = "2024.06.00"
voyager = "1.0.0"
lifecycle = "2.8.4"
@ -18,6 +17,7 @@ about_libraries = "11.2.2"
[plugins]
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
[libraries]
android-agp = { module = "com.android.tools.build:gradle", version.ref = "android_agp" }
@ -64,8 +64,8 @@ koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" }
koin-core = { module = "io.insert-koin:koin-core" }
koin-android = { module = "io.insert-koin:koin-android" }
koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose" }
koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin-bom" }
koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin-bom" }
koin-test = { module = "io.insert-koin:koin-test" }
koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4" }
paging-runtime = { module = "androidx.paging:paging-runtime-ktx", version.ref = "paging" }
paging-compose = { module = "androidx.paging:paging-compose", version.ref = "paging" }
@ -113,7 +113,7 @@ lifecycle = ["lifecycle-viewmodel-ktx", "lifecycle-viewmodel-compose", "lifecycl
coil = ["coil-core", "coil-compose"]
coroutines = ["coroutines-core", "coroutines-android"]
room = ["room-runtime", "room-ktx", "room-paging"]
koin = ["koin-bom", "koin-core", "koin-android", "koin-androidx-compose"]
koin = ["koin-core", "koin-android", "koin-androidx-compose"]
kointest = ["koin-test", "koin-test-junit4"]
paging = ["paging-runtime", "paging-compose"]
test = ["junit4", "ext-junit", "ext-runner", "ext-rules", "expressocore"]

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip