From 08eb9552d65d4cefdd014ba142489be06fb06a96 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Fri, 4 Aug 2023 15:58:57 +0300 Subject: [PATCH] Update gradle, kotlin and enum extensions --- build.gradle | 6 +++--- buildSrc/build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- kotatsu-parsers-ksp/build.gradle | 2 +- .../org/koitharu/kotatsu/parsers/MangaParser.kt | 2 +- .../org/koitharu/kotatsu/parsers/util/Collection.kt | 1 - .../org/koitharu/kotatsu/parsers/util/Enum.kt | 13 +++++++++++++ .../koitharu/kotatsu/parsers/AuthCheckExtension.kt | 2 +- 8 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 src/main/kotlin/org/koitharu/kotatsu/parsers/util/Enum.kt diff --git a/build.gradle b/build.gradle index e6f0ed3e4..3a47f8391 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ import tasks.ReportGenerateTask plugins { id 'java-library' - id 'org.jetbrains.kotlin.jvm' version '1.8.22' - id 'com.google.devtools.ksp' version '1.8.22-1.0.11' + id 'org.jetbrains.kotlin.jvm' version '1.9.0' + id 'com.google.devtools.ksp' version '1.9.0-1.0.13' id 'maven-publish' } @@ -53,7 +53,7 @@ afterEvaluate { } dependencies { - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' implementation 'com.squareup.okhttp3:okhttp:4.11.0' implementation 'com.squareup.okio:okio:3.3.0' api 'org.jsoup:jsoup:1.16.1' diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index a9cd773f0..0ee3993fe 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -8,6 +8,6 @@ repositories { dependencies { implementation gradleApi() implementation 'org.simpleframework:simple-xml:2.7.1' - implementation 'com.soywiz.korlibs.korte:korte-jvm:4.0.6' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1' + implementation 'com.soywiz.korlibs.korte:korte-jvm:4.0.9' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fae08049a..15de90249 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kotatsu-parsers-ksp/build.gradle b/kotatsu-parsers-ksp/build.gradle index 0bd9823cb..4e291ba1c 100644 --- a/kotatsu-parsers-ksp/build.gradle +++ b/kotatsu-parsers-ksp/build.gradle @@ -3,5 +3,5 @@ plugins { } dependencies { - implementation 'com.google.devtools.ksp:symbol-processing-api:1.8.22-1.0.11' + implementation 'com.google.devtools.ksp:symbol-processing-api:1.9.0-1.0.13' } diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt index 688e79e52..2dc793f4f 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt @@ -50,7 +50,7 @@ abstract class MangaParser @InternalParsersApi constructor( protected open val defaultSortOrder: SortOrder get() { val supported = sortOrders - return SortOrder.values().first { it in supported } + return SortOrder.entries.first { it in supported } } @JvmField diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Collection.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Collection.kt index 3cfcfbfca..3024e4c34 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Collection.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Collection.kt @@ -40,7 +40,6 @@ inline fun Array.mapToArray(transform: (T) -> R): Array = A } fun List>.toMutableMap(): MutableMap = toMap(ArrayMap(size)) -fun > Array.names() = mapToArray { it.name } fun MutableList.move(sourceIndex: Int, targetIndex: Int) { if (sourceIndex <= targetIndex) { diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Enum.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Enum.kt new file mode 100644 index 000000000..2ff419fae --- /dev/null +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/util/Enum.kt @@ -0,0 +1,13 @@ +@file:JvmName("EnumUtils") + +package org.koitharu.kotatsu.parsers.util + +import kotlin.enums.EnumEntries + +fun > EnumEntries.names() = Array(size) { i -> + get(i).name +} + +fun > EnumEntries.find(name: String): E? { + return find { x -> x.name == name } +} diff --git a/src/test/kotlin/org/koitharu/kotatsu/parsers/AuthCheckExtension.kt b/src/test/kotlin/org/koitharu/kotatsu/parsers/AuthCheckExtension.kt index 3003a07cb..83dc24b39 100644 --- a/src/test/kotlin/org/koitharu/kotatsu/parsers/AuthCheckExtension.kt +++ b/src/test/kotlin/org/koitharu/kotatsu/parsers/AuthCheckExtension.kt @@ -11,7 +11,7 @@ class AuthCheckExtension : BeforeAllCallback { private val loaderContext: MangaLoaderContext = MangaLoaderContextMock override fun beforeAll(context: ExtensionContext) { - for (source in MangaSource.values()) { + for (source in MangaSource.entries) { if (source == MangaSource.LOCAL || source == MangaSource.DUMMY) { continue }