diff --git a/CHANGELOG.md b/CHANGELOG.md index 7732b44637..a58c2b140f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,3 +34,4 @@ - Migrated most of manga related queries - Update Japenese translation - Update dependency com.github.tachiyomiorg:unifile to a9de196cc7 +- Update project to Kotlin 2.0 diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7d10a1fbf2..1efb7f8d2b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.io.ByteArrayOutputStream import java.time.LocalDateTime import java.time.ZoneOffset @@ -12,6 +13,7 @@ plugins { id("com.google.android.gms.oss-licenses-plugin") id("com.google.gms.google-services") apply false id("com.google.firebase.crashlytics") apply false + alias(kotlinx.plugins.compose.compiler) } if (gradle.startParameter.taskRequests.toString().contains("Standard")) { @@ -135,10 +137,6 @@ android { checkReleaseBuilds = false } - composeOptions { - kotlinCompilerExtensionVersion = compose.versions.compose.compiler.get() - } - namespace = "eu.kanade.tachiyomi" } @@ -151,6 +149,7 @@ dependencies { implementation(projects.sourceApi) // Compose + implementation(platform(compose.bom)) implementation(compose.bundles.compose) debugImplementation(compose.ui.tooling) implementation(libs.compose.theme.adapter3) @@ -274,8 +273,8 @@ dependencies { tasks { // See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers) - withType { - kotlinOptions.freeCompilerArgs += listOf( + withType { + compilerOptions.freeCompilerArgs.addAll( "-Xcontext-receivers", // "-opt-in=kotlin.Experimental", "-opt-in=kotlin.RequiresOptIn", @@ -298,12 +297,12 @@ tasks { ) if (project.findProperty("tachiyomi.enableComposeCompilerMetrics") == "true") { - kotlinOptions.freeCompilerArgs += listOf( + compilerOptions.freeCompilerArgs.addAll( "-P", "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + (project.layout.buildDirectory.asFile.orNull?.absolutePath ?: "/tmp/yokai") + "/compose_metrics", ) - kotlinOptions.freeCompilerArgs += listOf( + compilerOptions.freeCompilerArgs.addAll( "-P", "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + (project.layout.buildDirectory.asFile.orNull?.absolutePath ?: "/tmp/yokai") + "/compose_metrics", diff --git a/build.gradle.kts b/build.gradle.kts index 3563bb292f..e1daaf5627 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,15 @@ import com.android.build.gradle.BaseExtension import com.android.build.gradle.BasePlugin import org.gradle.api.tasks.testing.logging.TestLogEvent -import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.util.* plugins { alias(libs.plugins.kotlinter) alias(libs.plugins.gradle.versions) alias(kotlinx.plugins.android) apply false + alias(kotlinx.plugins.compose.compiler) apply false } buildscript { @@ -29,9 +31,9 @@ buildscript { } subprojects { - tasks.withType { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() + tasks.withType { + compilerOptions { + jvmTarget = JvmTarget.JVM_17 } } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 4b2f510137..9650f05229 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { kotlin("multiplatform") kotlin("plugin.serialization") @@ -47,8 +49,8 @@ android { } tasks { - withType { - kotlinOptions.freeCompilerArgs += listOf( + withType { + compilerOptions.freeCompilerArgs.addAll( "-Xcontext-receivers", "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", "-opt-in=kotlinx.serialization.ExperimentalSerializationApi", diff --git a/gradle/compose.versions.toml b/gradle/compose.versions.toml index 548e1c08e1..2e902e7db5 100644 --- a/gradle/compose.versions.toml +++ b/gradle/compose.versions.toml @@ -1,16 +1,16 @@ [versions] -compose = "1.6.7" -compose-compiler = "1.5.14" +compose-bom = "2024.06.00" [libraries] -animation = { module = "androidx.compose.animation:animation", version.ref = "compose" } -foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } +bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" } +animation = { module = "androidx.compose.animation:animation" } +foundation = { module = "androidx.compose.foundation:foundation" } material3 = { module = "androidx.compose.material3:material3", version = "1.3.0-beta02" } material-motion = { module = "io.github.fornewid:material-motion-compose-core", version = "1.0.7" } -ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } -ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } -ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } -icons = { module = "androidx.compose.material:material-icons-extended", version.ref = "compose" } +ui = { module = "androidx.compose.ui:ui" } +ui-tooling = { module = "androidx.compose.ui:ui-tooling" } +ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } +icons = { module = "androidx.compose.material:material-icons-extended" } [bundles] compose = [ "animation", "foundation", "material3", "material-motion", "ui", "ui-tooling-preview", "icons" ] diff --git a/gradle/kotlinx.versions.toml b/gradle/kotlinx.versions.toml index 8c4afaf538..96fc85256c 100644 --- a/gradle/kotlinx.versions.toml +++ b/gradle/kotlinx.versions.toml @@ -1,10 +1,11 @@ [versions] -kotlin = "1.9.24" -serialization = "1.6.2" +kotlin = "2.0.0" +serialization = "1.6.3" xml_serialization = "0.86.3" [libraries] -coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version = "1.8.0" } +compose-compiler-gradle = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" } +coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version = "1.8.1" } coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android" } coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core" } coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test" } @@ -26,3 +27,4 @@ coroutines = [ "coroutines-android", "coroutines-core" ] [plugins] android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } diff --git a/i18n/build.gradle.kts b/i18n/build.gradle.kts index 7d719bdf4d..95688c3e37 100644 --- a/i18n/build.gradle.kts +++ b/i18n/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { kotlin("multiplatform") id("com.android.library") @@ -36,8 +38,8 @@ tasks { // dependsOn(localesConfigTask) // } - withType { - kotlinOptions.freeCompilerArgs += listOf( + withType { + compilerOptions.freeCompilerArgs.addAll( "-Xexpect-actual-classes", ) } diff --git a/presentation/widget/build.gradle.kts b/presentation/widget/build.gradle.kts index 52fb9313b2..150ce636a5 100644 --- a/presentation/widget/build.gradle.kts +++ b/presentation/widget/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("com.android.library") id("org.jetbrains.kotlin.android") + alias(kotlinx.plugins.compose.compiler) } android { @@ -14,10 +15,6 @@ android { buildFeatures { compose = true } - - composeOptions { - kotlinCompilerExtensionVersion = compose.versions.compose.compiler.get() - } } dependencies { diff --git a/source-api/build.gradle.kts b/source-api/build.gradle.kts index 0cbb0380dc..f0c17718e1 100644 --- a/source-api/build.gradle.kts +++ b/source-api/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { kotlin("multiplatform") kotlin("plugin.serialization") @@ -34,8 +36,8 @@ android { } } tasks { - withType { - kotlinOptions.freeCompilerArgs += listOf( + withType { + compilerOptions.freeCompilerArgs.addAll( "-Xexpect-actual-classes", ) }