chore(deps): update kotlin and compose compiler to v2 (major) (#819)
* chore(deps): update kotlin and compose compiler to v2 * Update .gitignore * Fix build --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> (cherry picked from commit 46003ec25139319079abc9fde89b3afd344a1a11) # Conflicts: # .github/renovate.json5 # gradle/compose.versions.toml # source-local/src/androidMain/kotlin/tachiyomi/source/local/LocalSource.kt
This commit is contained in:
parent
0121fe9397
commit
6a1ff99441
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.gradle
|
||||
.kotlin
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
.DS_Store
|
||||
|
@ -302,7 +302,7 @@ androidComponents {
|
||||
tasks {
|
||||
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
|
||||
withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-Xcontext-receivers",
|
||||
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
||||
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
|
||||
|
@ -3,14 +3,16 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(androidx.gradle)
|
||||
implementation(kotlinx.gradle)
|
||||
implementation(kotlinx.compose.compiler.gradle)
|
||||
implementation(libs.detekt.gradlePlugin)
|
||||
implementation(gradleApi())
|
||||
|
||||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
implementation(files(androidx.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
implementation(files(compose.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
implementation(files(kotlinx.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
implementation(androidx.gradle)
|
||||
implementation(kotlinx.gradle)
|
||||
implementation(libs.detekt.gradlePlugin)
|
||||
implementation(gradleApi())
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import mihon.buildlogic.AndroidConfig
|
||||
import mihon.buildlogic.configureCompose
|
||||
|
||||
plugins {
|
||||
|
@ -1,11 +1,15 @@
|
||||
package mihon.buildlogic
|
||||
|
||||
import org.gradle.api.JavaVersion as GradleJavaVersion
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget as KotlinJvmTarget
|
||||
|
||||
object AndroidConfig {
|
||||
const val COMPILE_SDK = 34
|
||||
const val TARGET_SDK = 34
|
||||
const val MIN_SDK = 23
|
||||
const val NDK = "26.1.10909125"
|
||||
|
||||
// https://youtrack.jetbrains.com/issue/KT-66995/JvmTarget-and-JavaVersion-compatibility-for-easier-JVM-version-setup
|
||||
val JavaVersion = GradleJavaVersion.VERSION_17
|
||||
val JvmTarget = KotlinJvmTarget.JVM_17
|
||||
}
|
||||
|
@ -8,9 +8,12 @@ import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
import org.gradle.kotlin.dsl.the
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
val Project.androidx get() = the<LibrariesForAndroidx>()
|
||||
@ -37,15 +40,18 @@ internal fun Project.configureAndroid(commonExtension: CommonExtension<*, *, *,
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = AndroidConfig.JavaVersion.toString()
|
||||
// freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
|
||||
// freeCompilerArgs += "-Xcontext-receivers"
|
||||
compilerOptions {
|
||||
jvmTarget.set(AndroidConfig.JvmTarget)
|
||||
freeCompilerArgs.addAll(
|
||||
"-opt-in=kotlin.RequiresOptIn",
|
||||
"-Xcontext-receivers",
|
||||
)
|
||||
|
||||
// Treat all Kotlin warnings as errors (disabled by default)
|
||||
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
|
||||
// val warningsAsErrors: String? by project
|
||||
// allWarningsAsErrors = warningsAsErrors.toBoolean()
|
||||
val warningsAsErrors: String? by project
|
||||
allWarningsAsErrors.set(warningsAsErrors.toBoolean())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,51 +61,41 @@ internal fun Project.configureAndroid(commonExtension: CommonExtension<*, *, *,
|
||||
}
|
||||
|
||||
internal fun Project.configureCompose(commonExtension: CommonExtension<*, *, *, *, *, *>) {
|
||||
pluginManager.apply(kotlinx.plugins.compose.compiler.get().pluginId)
|
||||
|
||||
commonExtension.apply {
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = compose.versions.compiler.get()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"implementation"(platform(compose.bom))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += buildComposeMetricsParameters()
|
||||
extensions.configure<ComposeCompilerGradlePluginExtension> {
|
||||
// Enable strong skipping mode
|
||||
enableStrongSkippingMode.set(true)
|
||||
|
||||
// Enable experimental compiler opts
|
||||
// https://developer.android.com/jetpack/androidx/releases/compose-compiler#1.5.9
|
||||
freeCompilerArgs += listOf(
|
||||
"-P",
|
||||
"plugin:androidx.compose.compiler.plugins.kotlin:nonSkippingGroupOptimization=true",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Project.buildComposeMetricsParameters(): List<String> {
|
||||
val rootProjectDir = rootProject.layout.buildDirectory.asFile.get()
|
||||
val relativePath = projectDir.relativeTo(rootDir)
|
||||
enableNonSkippingGroupOptimization.set(true)
|
||||
|
||||
val enableMetrics = project.providers.gradleProperty("enableComposeCompilerMetrics").orNull.toBoolean()
|
||||
val enableReports = project.providers.gradleProperty("enableComposeCompilerReports").orNull.toBoolean()
|
||||
|
||||
return listOfNotNull(
|
||||
("metricsDestination" to "compose-metrics").takeIf { enableMetrics },
|
||||
("reportsDestination" to "compose-reports").takeIf { enableReports },
|
||||
).flatMap { (flag, dirName) ->
|
||||
val buildDirPath = rootProjectDir.resolve(dirName).resolve(relativePath).absolutePath
|
||||
listOf(
|
||||
"-P",
|
||||
"plugin:androidx.compose.compiler.plugins.kotlin:$flag=$buildDirPath"
|
||||
)
|
||||
val rootProjectDir = rootProject.layout.buildDirectory.asFile.get()
|
||||
val relativePath = projectDir.relativeTo(rootDir)
|
||||
if (enableMetrics) {
|
||||
val buildDirPath = rootProjectDir.resolve("compose-metrics").resolve(relativePath)
|
||||
metricsDestination.set(buildDirPath)
|
||||
}
|
||||
if (enableReports) {
|
||||
val buildDirPath = rootProjectDir.resolve("compose-reports").resolve(relativePath)
|
||||
reportsDestination.set(buildDirPath)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal fun Project.configureTest() {
|
||||
|
@ -33,7 +33,7 @@ dependencies {
|
||||
|
||||
tasks {
|
||||
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-Xcontext-receivers",
|
||||
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
||||
)
|
||||
|
@ -35,7 +35,7 @@ dependencies {
|
||||
|
||||
tasks {
|
||||
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-Xcontext-receivers",
|
||||
)
|
||||
|
@ -1,12 +1,9 @@
|
||||
[versions]
|
||||
compiler = "1.5.14"
|
||||
# 2024.04.00-alpha01 has several bugs with the new animateItem() modifier
|
||||
compose-bom = "2024.03.00-alpha02"
|
||||
accompanist = "0.35.0-alpha"
|
||||
|
||||
[libraries]
|
||||
compiler = { module = "androidx.compose.compiler:compiler", version.ref = "compiler" }
|
||||
|
||||
activity = "androidx.activity:activity-compose:1.9.0"
|
||||
bom = { group = "dev.chrisbanes.compose", name = "compose-bom", version.ref = "compose-bom" }
|
||||
foundation = { module = "androidx.compose.foundation:foundation" }
|
||||
|
@ -1,11 +1,12 @@
|
||||
[versions]
|
||||
kotlin_version = "1.9.24"
|
||||
kotlin_version = "2.0.0"
|
||||
serialization_version = "1.6.3"
|
||||
xml_serialization_version = "0.86.3"
|
||||
|
||||
[libraries]
|
||||
reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin_version" }
|
||||
gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin_version" }
|
||||
compose-compiler-gradle = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin_version" }
|
||||
|
||||
immutables = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version = "0.3.7" }
|
||||
|
||||
@ -28,4 +29,5 @@ serialization = ["serialization-json", "serialization-json-okio", "serialization
|
||||
|
||||
[plugins]
|
||||
android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version" }
|
||||
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin_version" }
|
||||
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin_version" }
|
@ -42,7 +42,7 @@ multiplatformResources {
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-Xexpect-actual-classes",
|
||||
)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ tasks {
|
||||
}
|
||||
|
||||
withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-Xexpect-actual-classes",
|
||||
)
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ dependencies {
|
||||
tasks {
|
||||
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
|
||||
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
||||
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
|
||||
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
||||
|
@ -44,7 +44,7 @@ android {
|
||||
|
||||
tasks {
|
||||
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-Xexpect-actual-classes",
|
||||
)
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ android {
|
||||
|
||||
tasks {
|
||||
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
compilerOptions.freeCompilerArgs.addAll(
|
||||
"-Xexpect-actual-classes",
|
||||
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
||||
)
|
||||
|
@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.UnmeteredSource
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder
|
||||
@ -384,7 +385,7 @@ actual class LocalSource(
|
||||
override fun getFilterList() = FilterList(OrderBy.Popular(context))
|
||||
|
||||
// Unused stuff
|
||||
override suspend fun getPageList(chapter: SChapter) = throw UnsupportedOperationException("Unused")
|
||||
override suspend fun getPageList(chapter: SChapter): List<Page> = throw UnsupportedOperationException("Unused")
|
||||
|
||||
fun getFormat(chapter: SChapter): Format {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user