Multisrc bugfix and genkan refactor (#5707)

* themesource bugfix, refactor genkan

* revert 3da46570aa
This commit is contained in:
Aria Moradi 2021-02-08 13:37:48 -08:00 committed by GitHub
parent f1a7a5aac2
commit 0ce4416f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 57 additions and 31 deletions

View File

@ -102,6 +102,16 @@ 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/dev/app/src/main/java/eu/kanade/tachiyomi/source). Referencing the actual implementation will help with understanding extensions' call flow. 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/dev/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 #### 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/). [`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/).

View File

@ -0,0 +1,7 @@
plugins {
id("kotlin")
}
dependencies {
compileOnly(Deps.kotlin.stdlib)
}

View File

@ -12,4 +12,7 @@ dependencies {
compileOnly 'org.jsoup:jsoup:1.10.2' compileOnly 'org.jsoup:jsoup:1.10.2'
compileOnly 'com.google.code.gson:gson:2.8.2' compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0' compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
implementation project(":annotations")
compileOnly project(':duktape-stub')
} }

View File

@ -1,6 +1,5 @@
plugins { plugins {
id("com.android.library") id("com.android.library")
kotlin("android")
} }
android { android {
@ -13,7 +12,6 @@ android {
sourceSets { sourceSets {
named("main") { named("main") {
manifest.srcFile("AndroidManifest.xml") manifest.srcFile("AndroidManifest.xml")
java.setSrcDirs(listOf("src"))
res.setSrcDirs(listOf("res")) res.setSrcDirs(listOf("res"))
} }
} }
@ -23,17 +21,4 @@ android {
enabled = false enabled = false
} }
} }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
compileOnly(Deps.kotlin.stdlib)
} }

View File

@ -0,0 +1,16 @@
plugins {
java
}
sourceSets {
main {
java {
srcDirs(listOf("src"))
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@ -135,9 +135,9 @@ interface ThemeSourceGenerator {
private fun writeSourceClasses(projectSrcPath: String, srcOverridePath: String, source: ThemeSourceData, themePkg: String, themeClass: String) { private fun writeSourceClasses(projectSrcPath: String, srcOverridePath: String, source: ThemeSourceData, themePkg: String, themeClass: String) {
val projectSrcFile = File(projectSrcPath) val projectSrcFile = File(projectSrcPath)
projectSrcFile.mkdirs() projectSrcFile.mkdirs()
val srcOverride = File("$srcOverridePath/${source.pkgName}") val srcOverrideFile = File(srcOverridePath)
if (srcOverride.exists()) if (srcOverrideFile.exists())
srcOverride.copyRecursively(projectSrcFile) srcOverrideFile.copyRecursively(projectSrcFile)
else else
writeSourceClass(projectSrcFile, source, themePkg, themeClass) writeSourceClass(projectSrcFile, source, themePkg, themeClass)
} }

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.multisrc.genkan package eu.kanade.tachiyomi.multisrc.genkan
import eu.kanade.tachiyomi.multisrc.ThemeSourceData import eu.kanade.tachiyomi.multisrc.ThemeSourceData.SingleLang
import eu.kanade.tachiyomi.multisrc.ThemeSourceData.MultiLang
import eu.kanade.tachiyomi.multisrc.ThemeSourceGenerator import eu.kanade.tachiyomi.multisrc.ThemeSourceGenerator
class GenkanGenerator : ThemeSourceGenerator { class GenkanGenerator : ThemeSourceGenerator {
@ -12,14 +13,14 @@ class GenkanGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 1 override val baseVersionCode: Int = 1
override val sources = listOf( override val sources = listOf(
ThemeSourceData.MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"),
className = "LeviatanScansFactory", pkgName = "leviatanscans", overrideVersionCode = 1), className = "LeviatanScansFactory", pkgName = "leviatanscans", overrideVersionCode = 1),
ThemeSourceData.SingleLang("Hunlight Scans", "https://hunlight-scans.info", "en"), SingleLang("Hunlight Scans", "https://hunlight-scans.info", "en"),
ThemeSourceData.SingleLang("ZeroScans", "https://zeroscans.com", "en"), SingleLang("ZeroScans", "https://zeroscans.com", "en"),
ThemeSourceData.SingleLang("The Nonames Scans", "https://the-nonames.com", "en"), SingleLang("The Nonames Scans", "https://the-nonames.com", "en"),
ThemeSourceData.SingleLang("Edelgarde Scans", "https://edelgardescans.com", "en"), SingleLang("Edelgarde Scans", "https://edelgardescans.com", "en"),
ThemeSourceData.SingleLang("Method Scans", "https://methodscans.com", "en"), SingleLang("Method Scans", "https://methodscans.com", "en"),
ThemeSourceData.SingleLang("Sleeping Knight Scans", "https://skscans.com", "en") SingleLang("Sleeping Knight Scans", "https://skscans.com", "en")
) )
companion object { companion object {

View File

@ -1,6 +1,6 @@
package eu.kanade.tachiyomi.multisrc.genkan package eu.kanade.tachiyomi.multisrc.genkan
import eu.kanade.tachiyomi.multisrc.ThemeSourceData import eu.kanade.tachiyomi.multisrc.ThemeSourceData.SingleLang
import eu.kanade.tachiyomi.multisrc.ThemeSourceGenerator import eu.kanade.tachiyomi.multisrc.ThemeSourceGenerator
class GenkanOriginalGenerator : ThemeSourceGenerator { class GenkanOriginalGenerator : ThemeSourceGenerator {
@ -12,9 +12,9 @@ class GenkanOriginalGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 1 override val baseVersionCode: Int = 1
override val sources = listOf( override val sources = listOf(
ThemeSourceData.SingleLang("Reaper Scans", "https://reaperscans.com", "en"), SingleLang("Reaper Scans", "https://reaperscans.com", "en"),
ThemeSourceData.SingleLang("Hatigarm Scans", "https://hatigarmscanz.net", "en", overrideVersionCode = 1), SingleLang("Hatigarm Scans", "https://hatigarmscanz.net", "en", overrideVersionCode = 1),
ThemeSourceData.SingleLang("SecretScans", "https://secretscans.co", "en"), SingleLang("SecretScans", "https://secretscans.co", "en"),
) )
companion object { companion object {

View File

@ -1,8 +1,12 @@
include(":annotations")
include(":core") include(":core")
include(":lib-ratelimit") include(":lib-ratelimit")
project(":lib-ratelimit").projectDir = File("lib/ratelimit") project(":lib-ratelimit").projectDir = File("lib/ratelimit")
include(":duktape-stub")
project(":duktape-stub").projectDir = File("lib/duktape-stub")
include(":lib-dataimage") include(":lib-dataimage")
project(":lib-dataimage").projectDir = File("lib/dataimage") project(":lib-dataimage").projectDir = File("lib/dataimage")