From 39b7fe8c4ebab4d7c6fb9c7d7e11800fc02050b4 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 28 Nov 2021 13:00:39 -0500 Subject: [PATCH] Move Duktape stub to extensions-lib (#9954) * Move Duktape stub to extensions-lib * Formatting fixes * Address build errors --- CONTRIBUTING.md | 10 ------- common-dependencies.gradle | 4 +-- lib/duktape-stub/build.gradle.kts | 16 ------------ .../src/com/squareup/duktape/Duktape.java | 26 ------------------- .../src/FoolSlideCustomizableFactory.kt | 2 +- .../madara/neoxscanlator/src/NeoxScanlator.kt | 2 +- .../madara/neoxxxscans/src/NeoXXXScans.kt | 2 +- settings.gradle.kts | 3 --- .../extension/all/mangapark/MangaPark.kt | 2 +- .../extension/all/tappytoon/Tappytoon.kt | 1 - .../extension/ar/mangalink/MangaLink.kt | 2 +- .../extension/en/mangadig/MangaDig.kt | 2 +- .../es/tumangaonline/TuMangaOnline.kt | 2 +- .../extension/id/doujindesu/DoujinDesu.kt | 4 +-- .../tachiyomi/extension/ko/jmana/JMana.kt | 2 +- .../tachiyomi/extension/ko/newtoki/NewToki.kt | 2 +- .../tachiyomi/extension/ru/desu/Desu.kt | 1 - 17 files changed, 12 insertions(+), 71 deletions(-) delete mode 100644 lib/duktape-stub/build.gradle.kts delete mode 100644 lib/duktape-stub/src/com/squareup/duktape/Duktape.java diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 25ef4d6ef..76b539622 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,16 +101,6 @@ The extension's version name is generated automatically by concatenating `libVer Extensions rely on [extensions-lib](https://github.com/tachiyomiorg/extensions-lib), which provides some interfaces and stubs from the [app](https://github.com/tachiyomiorg/tachiyomi) for compilation purposes. The actual implementations can be found [here](https://github.com/tachiyomiorg/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/source). Referencing the actual implementation will help with understanding extensions' call flow. -#### Duktape stub - -[`duktape-stub`](https://github.com/tachiyomiorg/tachiyomi-extensions/tree/master/lib/duktape-stub) provides stubs for using Duktape functionality without pulling in the full library. Functionality is bundled into the main Tachiyomi app. - -```gradle -dependencies { - compileOnly project(':duktape-stub') -} -``` - #### Rate limiting library [`lib-ratelimit`](https://github.com/tachiyomiorg/tachiyomi-extensions/tree/master/lib/ratelimit) is a library for adding rate limiting functionality as an [OkHttp interceptor](https://square.github.io/okhttp/interceptors/). diff --git a/common-dependencies.gradle b/common-dependencies.gradle index 6b8a334db..32ad3da04 100644 --- a/common-dependencies.gradle +++ b/common-dependencies.gradle @@ -1,7 +1,7 @@ // used both in common.gradle and themesources library dependencies { // Lib 1.2, but using specific commit so we don't need to bump up the version - compileOnly "com.github.tachiyomiorg:extensions-lib:cfa9530" + compileOnly "com.github.tachiyomiorg:extensions-lib:58b2d3a" // These are provided by the app itself compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" @@ -14,6 +14,4 @@ dependencies { compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0' compileOnly 'org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.2.0' compileOnly 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0' - - compileOnly project(':duktape-stub') } diff --git a/lib/duktape-stub/build.gradle.kts b/lib/duktape-stub/build.gradle.kts deleted file mode 100644 index b07c0af69..000000000 --- a/lib/duktape-stub/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - java -} - -sourceSets { - main { - java { - srcDirs(listOf("src")) - } - } -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} diff --git a/lib/duktape-stub/src/com/squareup/duktape/Duktape.java b/lib/duktape-stub/src/com/squareup/duktape/Duktape.java deleted file mode 100644 index 12bdb0252..000000000 --- a/lib/duktape-stub/src/com/squareup/duktape/Duktape.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.squareup.duktape; - -import java.io.Closeable; -import java.io.IOException; - -@SuppressWarnings("all") -public class Duktape implements Closeable { - - public static Duktape create() { - throw new RuntimeException("Stub!"); - } - - @Override - public synchronized void close() throws IOException { - throw new RuntimeException("Stub!"); - } - - public synchronized Object evaluate(String script) { - throw new RuntimeException("Stub!"); - } - - public synchronized void set(String name, Class type, T object) { - throw new RuntimeException("Stub!"); - } - -} \ No newline at end of file diff --git a/multisrc/overrides/foolslide/foolslidecustomizable/src/FoolSlideCustomizableFactory.kt b/multisrc/overrides/foolslide/foolslidecustomizable/src/FoolSlideCustomizableFactory.kt index c7a349599..36640e2eb 100644 --- a/multisrc/overrides/foolslide/foolslidecustomizable/src/FoolSlideCustomizableFactory.kt +++ b/multisrc/overrides/foolslide/foolslidecustomizable/src/FoolSlideCustomizableFactory.kt @@ -42,7 +42,7 @@ class FoolSlideCustomizable : FoolSlide("FoolSlide Customizable", "", "other") { companion object { private const val DEFAULT_BASEURL = "https://127.0.0.1" private const val BASE_URL_PREF_TITLE = "Example URL: https://domain.com/path_to/directory/" - private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}" + private val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}" private const val BASE_URL_PREF_SUMMARY = "Connect to a designated FoolSlide server" private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting." } diff --git a/multisrc/overrides/madara/neoxscanlator/src/NeoxScanlator.kt b/multisrc/overrides/madara/neoxscanlator/src/NeoxScanlator.kt index 0db987bf1..dde2c88ee 100644 --- a/multisrc/overrides/madara/neoxscanlator/src/NeoxScanlator.kt +++ b/multisrc/overrides/madara/neoxscanlator/src/NeoxScanlator.kt @@ -135,7 +135,7 @@ class NeoxScanlator : private const val REFERER = "https://google.com/" private const val DEFAULT_BASE_URL = "https://neoxscans.net" - private const val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}" + private val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}" private const val BASE_URL_PREF_TITLE = "URL da fonte" private const val BASE_URL_PREF_SUMMARY = "Para uso temporário. Quando você atualizar a " + "extensão, esta configuração será apagada." diff --git a/multisrc/overrides/madara/neoxxxscans/src/NeoXXXScans.kt b/multisrc/overrides/madara/neoxxxscans/src/NeoXXXScans.kt index 6bbe4f07b..dae8ba9ac 100644 --- a/multisrc/overrides/madara/neoxxxscans/src/NeoXXXScans.kt +++ b/multisrc/overrides/madara/neoxxxscans/src/NeoXXXScans.kt @@ -65,7 +65,7 @@ class NeoXXXScans : companion object { private const val DEFAULT_BASE_URL = "https://xxx.neoxscans.net" - private const val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}" + private val BASE_URL_PREF_KEY = "base_url_${BuildConfig.VERSION_NAME}" private const val BASE_URL_PREF_TITLE = "URL da fonte" private const val BASE_URL_PREF_SUMMARY = "Para uso temporário. Quando você atualizar a " + "extensão, esta configuração será apagada." diff --git a/settings.gradle.kts b/settings.gradle.kts index 976c700ff..459698180 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,9 +3,6 @@ include(":core") include(":lib-ratelimit") project(":lib-ratelimit").projectDir = File("lib/ratelimit") -include(":duktape-stub") -project(":duktape-stub").projectDir = File("lib/duktape-stub") - include(":lib-dataimage") project(":lib-dataimage").projectDir = File("lib/dataimage") diff --git a/src/all/mangapark/src/eu/kanade/tachiyomi/extension/all/mangapark/MangaPark.kt b/src/all/mangapark/src/eu/kanade/tachiyomi/extension/all/mangapark/MangaPark.kt index aaa26ddf9..0ed3ed354 100644 --- a/src/all/mangapark/src/eu/kanade/tachiyomi/extension/all/mangapark/MangaPark.kt +++ b/src/all/mangapark/src/eu/kanade/tachiyomi/extension/all/mangapark/MangaPark.kt @@ -39,7 +39,7 @@ open class MangaPark( override val name: String = "MangaPark v3" - override val baseUrl: String = "https://v35.mangapark.net" //temporary url change to keep the ext working after update return to https://mangapark.net or https://v36.mangapark.net at later date + override val baseUrl: String = "https://v35.mangapark.net" // temporary url change to keep the ext working after update return to https://mangapark.net or https://v36.mangapark.net at later date override val supportsLatest = true diff --git a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt index 570b26d29..6e0cac0a1 100644 --- a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt +++ b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.extension.all.tappytoon -import android.util.Log import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList diff --git a/src/ar/mangalink/src/eu/kanade/tachiyomi/extension/ar/mangalink/MangaLink.kt b/src/ar/mangalink/src/eu/kanade/tachiyomi/extension/ar/mangalink/MangaLink.kt index 2398d3656..033e6c338 100644 --- a/src/ar/mangalink/src/eu/kanade/tachiyomi/extension/ar/mangalink/MangaLink.kt +++ b/src/ar/mangalink/src/eu/kanade/tachiyomi/extension/ar/mangalink/MangaLink.kt @@ -146,7 +146,7 @@ class MangaLink : ConfigurableSource, ParsedHttpSource() { Type("غير معروف", "6"), ) - //Preferences + // Preferences override fun setupPreferenceScreen(screen: PreferenceScreen) { val domainPref = ListPreference(screen.context).apply { diff --git a/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt b/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt index d8f2e9358..160874ae8 100644 --- a/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt +++ b/src/en/mangadig/src/eu/kanade/tachiyomi/extension/en/mangadig/MangaDig.kt @@ -58,7 +58,7 @@ class MangaDig : ConfigurableSource, ParsedHttpSource() { private val commonNextPageSelector = "a:contains(Next):not(.fed-btns-disad)" private fun commonMangaFromElement(element: Element): SManga { val picElement = element.select("a.fed-list-pics").first() - + return SManga.create().apply { title = element.select("a.fed-list-title").first().text() thumbnail_url = picElement.attr("data-original") diff --git a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt index 909bfd397..663c51b53 100644 --- a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt +++ b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt @@ -569,7 +569,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { private const val IMAGE_CDN_RATELIMIT_PREF_SUMMARY = "Este valor afecta la cantidad de solicitudes de red para descargar imágenes. Reducir este valor puede disminuir errores al cargar imagenes, pero la velocidad de descarga será más lenta. Se requiere reiniciar Tachiyomi. \nValor actual: %s" private const val IMAGE_CDN_RATELIMIT_PREF_DEFAULT_VALUE = "10" - private val ENTRIES_ARRAY = listOf(1,2,3,5,6,7,8,9,10,15,20,30,40,50,100).map { i -> i.toString() }.toTypedArray() + private val ENTRIES_ARRAY = listOf(1, 2, 3, 5, 6, 7, 8, 9, 10, 15, 20, 30, 40, 50, 100).map { i -> i.toString() }.toTypedArray() const val PREFIX_LIBRARY = "library" const val PREFIX_ID_SEARCH = "id:" diff --git a/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt b/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt index 8ff86d3c2..4f41e1ad4 100644 --- a/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt +++ b/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt @@ -24,11 +24,11 @@ class DoujinDesu : ParsedHttpSource() { override val client: OkHttpClient = network.cloudflareClient // Private stuff - + private val DATE_FORMAT by lazy { SimpleDateFormat("MMMM d, yyyy", Locale("id")) } - + private fun parseStatus(status: String) = when { status.toLowerCase(Locale.US).contains("finished") -> SManga.ONGOING status.toLowerCase(Locale.US).contains("publishing") -> SManga.COMPLETED diff --git a/src/ko/jmana/src/eu/kanade/tachiyomi/extension/ko/jmana/JMana.kt b/src/ko/jmana/src/eu/kanade/tachiyomi/extension/ko/jmana/JMana.kt index e450972c8..162f8c470 100644 --- a/src/ko/jmana/src/eu/kanade/tachiyomi/extension/ko/jmana/JMana.kt +++ b/src/ko/jmana/src/eu/kanade/tachiyomi/extension/ko/jmana/JMana.kt @@ -201,7 +201,7 @@ class JMana : ConfigurableSource, ParsedHttpSource() { const val DETAIL_DESCRIPTION = "설명 : " const val DEFAULT_BASEURL = "https://jmana1.net" private const val BASE_URL_PREF_TITLE = "Override BaseUrl" - private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}" + private val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}" private const val BASE_URL_PREF_SUMMARY = "For temporary uses. Update extension will erase this setting." private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting." } diff --git a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt index c9523f6f6..858e02f66 100644 --- a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt +++ b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt @@ -375,7 +375,7 @@ open class NewToki(override val name: String, private val defaultBaseUrl: String private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting." private const val BASE_URL_PREF_TITLE = "Override BaseUrl" - private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}" + private val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_NAME}" private const val BASE_URL_PREF_SUMMARY = "For temporary uses. Update extension will erase this setting." // Setting: Experimental Latest Fetcher diff --git a/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt b/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt index abe054359..31673f8ff 100644 --- a/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt +++ b/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt @@ -23,7 +23,6 @@ import okhttp3.Request import okhttp3.Response import rx.Observable import uy.kohesive.injekt.injectLazy -import java.util.ArrayList class Desu : HttpSource() { override val name = "Desu"