Skip to content

Commit

Permalink
Migrate to Kotlin 2.0 (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
fornewid authored May 28, 2024
1 parent e8738fd commit 714ea67
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
8 changes: 4 additions & 4 deletions app/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ org.brotli:dec:0.1.2
org.checkerframework:checker-qual:3.12.0
org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.22
org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22
org.jetbrains.kotlin:kotlin-stdlib-common:1.9.24
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.24
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.24
org.jetbrains.kotlin:kotlin-stdlib:1.9.24
org.jetbrains.kotlin:kotlin-stdlib-common:2.0.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.0
org.jetbrains.kotlin:kotlin-stdlib:2.0.0
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.8.1
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.1
Expand Down
1 change: 1 addition & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ java {
dependencies {
implementation(libs.android.pluginGradle)
implementation(libs.kotlin.pluginGradle)
implementation(libs.compose.compiler.pluginGradle)
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@ import com.android.build.gradle.BaseExtension
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension

fun Project.configureCompose() {
pluginManager.apply("org.jetbrains.kotlin.plugin.compose")

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
android {
buildFeatures.compose = true

composeOptions {
kotlinCompilerExtensionVersion =
libs.findVersion("compose-compiler").get().toString()
}

dependencies {
val bom = libs.findLibrary("compose-bom").get()
implementation(platform(bom))
androidTestImplementation(platform(bom))
}
}

extensions.configure<ComposeCompilerGradlePluginExtension> {
enableStrongSkippingMode = false
}
}

private fun Project.android(action: BaseExtension.() -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package soup.movie.buildlogic

import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun Project.configureKotlin() {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)

freeCompilerArgs = freeCompilerArgs + listOf(
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.gms) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.dagger.hilt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.dependencyGuard) apply false
Expand Down
7 changes: 4 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
androidGradlePlugin = "8.3.2"

# Kotlin
kotlin = "1.9.24"
kotlin = "2.0.0"
coroutines = "1.8.1"
serialization = "1.6.3"
ksp = "1.9.24-1.0.20"
ksp = "2.0.0-1.0.21"

# Dagger
dagger = "2.51.1"
Expand Down Expand Up @@ -40,7 +40,6 @@ firebase-perf = "1.4.2"

# Compose
compose-bom = "2024.05.00"
compose-compiler = "1.5.14"
accompanist = "0.34.0"
navermap-compose = "1.5.7"
readmore = "1.5.6"
Expand Down Expand Up @@ -169,6 +168,7 @@ timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
# Dependencies of the included build-logic
android-pluginGradle = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
kotlin-pluginGradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
compose-compiler-pluginGradle = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" }


[plugins]
Expand All @@ -178,6 +178,7 @@ gms = { id = "com.google.gms.google-services", version.ref = "gms" }
dagger-hilt = { id = "com.google.dagger.hilt.android", version.ref = "dagger" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
dependencyGuard = { id = "com.dropbox.dependency-guard", version.ref = "dependencyGuard" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" }
Expand Down

0 comments on commit 714ea67

Please sign in to comment.