diff --git a/.editorconfig b/.editorconfig index 1296f8944..895cf5622 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,5 @@ indent_size = 4 indent_style = space insert_final_newline = true trim_trailing_whitespace = true +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true diff --git a/build.gradle.kts b/build.gradle.kts index b3b8f26ca..50b671b21 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,23 +1,8 @@ -buildscript { - repositories { - mavenCentral() - google() - maven(url = "https://plugins.gradle.org/m2/") - } - dependencies { - classpath(libs.gradle.agp) - classpath(libs.gradle.kotlin) - classpath(libs.gradle.serialization) - classpath(libs.gradle.kotlinter) - } -} - -allprojects { - repositories { - mavenCentral() - google() - maven(url = "https://jitpack.io") - } +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.kotlinter) apply false } tasks.register("clean") { diff --git a/common.gradle b/common.gradle index 919ab4ebf..96c69c9cf 100644 --- a/common.gradle +++ b/common.gradle @@ -79,12 +79,16 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() - freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi" + freeCompilerArgs += "-opt-in=kotlinx.serialization.ExperimentalSerializationApi" } -} -repositories { - mavenCentral() + kotlinter { + experimentalRules = true + disabledRules = [ + "experimental:argument-list-wrapping", // Doesn't play well with Android Studio + "experimental:comment-wrapping", + ] + } } dependencies { @@ -92,5 +96,15 @@ dependencies { compileOnly(libs.bundles.common) } +configurations.all { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if (details.requested.group == 'org.jetbrains.kotlin' && details.requested.name == 'kotlin-stdlib-jdk8' && details.requested.version == '1.7.0') { + details.useVersion '1.7.21' + details.because 'Fix problems with dev.datlag JsUnpacker' + } + } +} + + preBuild.dependsOn(lintKotlin) lintKotlin.dependsOn(formatKotlin) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c878a525d..a55169910 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,14 +1,10 @@ [versions] -kotlin_version = "1.6.21" -coroutines_version = "1.6.0" -serialization_version = "1.3.2" +agp_version = "7.4.1" +coroutines_version = "1.6.4" +kotlin_version = "1.7.21" +serialization_version = "1.4.0" [libraries] -gradle-agp = { module = "com.android.tools.build:gradle", version = "7.2.1" } -gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin_version" } -gradle-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" } -gradle-kotlinter = { module = "org.jmailen.gradle:kotlinter-gradle", version = "3.6.0" } - aniyomi-lib = { module = "com.github.jmir1:extensions-lib", version = "a2f1874" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin_version" } @@ -19,14 +15,19 @@ coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", ve coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" } injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" } -jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" } -duktape = { module = "com.squareup.duktape:duktape-android", version = "1.4.0" } -quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" } -okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.9.1" } rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" } rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" } +jsoup = { module = "org.jsoup:jsoup", version = "1.15.3" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" } +quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" } [bundles] -common = ["kotlin-stdlib", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "aniyomi-lib", "duktape", "quickjs"] -coroutines = ["coroutines-core", "coroutines-android"] +common = ["kotlin-stdlib", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "aniyomi-lib", "quickjs", "coroutines-core", "coroutines-android"] reactivex = ["rxandroid"] + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp_version" } +android-library = { id = "com.android.library", version.ref = "agp_version" } +kotlinter = { id = "org.jmailen.kotlinter", version = "3.13.0" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin_version" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2..943f0cbfa 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fcea..f398c33c4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c78733..65dcd68d6 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/lib/dataimage/build.gradle.kts b/lib/dataimage/build.gradle.kts index d02fbec56..180419358 100644 --- a/lib/dataimage/build.gradle.kts +++ b/lib/dataimage/build.gradle.kts @@ -12,10 +12,6 @@ android { } } -repositories { - mavenCentral() -} - dependencies { compileOnly(libs.kotlin.stdlib) compileOnly(libs.okhttp) diff --git a/lib/dood-extractor/build.gradle.kts b/lib/dood-extractor/build.gradle.kts index 1c2f5bc51..2a2c5062b 100644 --- a/lib/dood-extractor/build.gradle.kts +++ b/lib/dood-extractor/build.gradle.kts @@ -12,13 +12,9 @@ android { } } -repositories { - mavenCentral() -} - dependencies { compileOnly(libs.kotlin.stdlib) compileOnly(libs.okhttp) compileOnly(libs.aniyomi.lib) } -// BUMPS: 0 \ No newline at end of file +// BUMPS: 0 diff --git a/lib/dood-extractor/src/main/java/eu/kanade/tachiyomi/lib/doodextractor/DoodExtractor.kt b/lib/dood-extractor/src/main/java/eu/kanade/tachiyomi/lib/doodextractor/DoodExtractor.kt index 6c4ca1223..3b1da2bf1 100644 --- a/lib/dood-extractor/src/main/java/eu/kanade/tachiyomi/lib/doodextractor/DoodExtractor.kt +++ b/lib/dood-extractor/src/main/java/eu/kanade/tachiyomi/lib/doodextractor/DoodExtractor.kt @@ -19,7 +19,7 @@ class DoodExtractor(private val client: OkHttpClient) { val newUrl = if(redirect) response.request.url.toString() else url val doodTld = newUrl.substringAfter("https://dood.").substringBefore("/") - val content = response.body!!.string() + val content = response.body.string() if (!content.contains("'/pass_md5/")) return null val md5 = content.substringAfter("'/pass_md5/").substringBefore("',") val token = md5.substringAfterLast("/") @@ -30,7 +30,7 @@ class DoodExtractor(private val client: OkHttpClient) { "https://dood.$doodTld/pass_md5/$md5", Headers.headersOf("referer", newUrl) ) - ).execute().body!!.string() + ).execute().body.string() val videoUrl = "$videoUrlStart$randomString?token=$token&expiry=$expiry" Video(newUrl, newQuality, videoUrl, headers = doodHeaders(doodTld)) } catch (e: Exception) { diff --git a/lib/fembed-extractor/build.gradle.kts b/lib/fembed-extractor/build.gradle.kts index 724f2aea6..6ffaf2993 100644 --- a/lib/fembed-extractor/build.gradle.kts +++ b/lib/fembed-extractor/build.gradle.kts @@ -13,14 +13,10 @@ android { } } -repositories { - mavenCentral() -} - dependencies { compileOnly(libs.kotlin.stdlib) compileOnly(libs.kotlin.json) compileOnly(libs.okhttp) compileOnly(libs.aniyomi.lib) } -// BUMPS: 0 \ No newline at end of file +// BUMPS: 0 diff --git a/lib/fembed-extractor/src/main/java/eu/kanade/tachiyomi/lib/fembedextractor/FembedExtractor.kt b/lib/fembed-extractor/src/main/java/eu/kanade/tachiyomi/lib/fembedextractor/FembedExtractor.kt index 2b3777f63..ab47c120b 100644 --- a/lib/fembed-extractor/src/main/java/eu/kanade/tachiyomi/lib/fembedextractor/FembedExtractor.kt +++ b/lib/fembed-extractor/src/main/java/eu/kanade/tachiyomi/lib/fembedextractor/FembedExtractor.kt @@ -16,7 +16,7 @@ class FembedExtractor(private val client: OkHttpClient) { url.replace("/v/", "/api/source/") } val body = runCatching { - client.newCall(POST(videoApi)).execute().body?.string().orEmpty() + client.newCall(POST(videoApi)).execute().body.string() }.getOrNull() ?: return emptyList