Skip to content

Commit

Permalink
Multisrc bugfix and genkan refactor (#5707)
Browse files Browse the repository at this point in the history
* themesource bugfix, refactor genkan

* revert 3da4657
  • Loading branch information
AriaMoradi authored Feb 8, 2021
1 parent f1a7a5a commit 0ce4416
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 31 deletions.
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

#### 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/).
Expand Down
7 changes: 7 additions & 0 deletions annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id("kotlin")
}

dependencies {
compileOnly(Deps.kotlin.stdlib)
}
File renamed without changes.
5 changes: 4 additions & 1 deletion common-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ dependencies {
compileOnly 'org.jsoup:jsoup:1.10.2'
compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
}

implementation project(":annotations")
compileOnly project(':duktape-stub')
}
15 changes: 0 additions & 15 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("com.android.library")
kotlin("android")
}

android {
Expand All @@ -13,7 +12,6 @@ android {
sourceSets {
named("main") {
manifest.srcFile("AndroidManifest.xml")
java.setSrcDirs(listOf("src"))
res.setSrcDirs(listOf("res"))
}
}
Expand All @@ -23,17 +21,4 @@ android {
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)
}
16 changes: 16 additions & 0 deletions lib/duktape-stub/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
java
}

sourceSets {
main {
java {
srcDirs(listOf("src"))
}
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ interface ThemeSourceGenerator {
private fun writeSourceClasses(projectSrcPath: String, srcOverridePath: String, source: ThemeSourceData, themePkg: String, themeClass: String) {
val projectSrcFile = File(projectSrcPath)
projectSrcFile.mkdirs()
val srcOverride = File("$srcOverridePath/${source.pkgName}")
if (srcOverride.exists())
srcOverride.copyRecursively(projectSrcFile)
val srcOverrideFile = File(srcOverridePath)
if (srcOverrideFile.exists())
srcOverrideFile.copyRecursively(projectSrcFile)
else
writeSourceClass(projectSrcFile, source, themePkg, themeClass)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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

class GenkanGenerator : ThemeSourceGenerator {
Expand All @@ -12,14 +13,14 @@ class GenkanGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 1

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),
ThemeSourceData.SingleLang("Hunlight Scans", "https://hunlight-scans.info", "en"),
ThemeSourceData.SingleLang("ZeroScans", "https://zeroscans.com", "en"),
ThemeSourceData.SingleLang("The Nonames Scans", "https://the-nonames.com", "en"),
ThemeSourceData.SingleLang("Edelgarde Scans", "https://edelgardescans.com", "en"),
ThemeSourceData.SingleLang("Method Scans", "https://methodscans.com", "en"),
ThemeSourceData.SingleLang("Sleeping Knight Scans", "https://skscans.com", "en")
SingleLang("Hunlight Scans", "https://hunlight-scans.info", "en"),
SingleLang("ZeroScans", "https://zeroscans.com", "en"),
SingleLang("The Nonames Scans", "https://the-nonames.com", "en"),
SingleLang("Edelgarde Scans", "https://edelgardescans.com", "en"),
SingleLang("Method Scans", "https://methodscans.com", "en"),
SingleLang("Sleeping Knight Scans", "https://skscans.com", "en")
)

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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

class GenkanOriginalGenerator : ThemeSourceGenerator {
Expand All @@ -12,9 +12,9 @@ class GenkanOriginalGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 1

override val sources = listOf(
ThemeSourceData.SingleLang("Reaper Scans", "https://reaperscans.com", "en"),
ThemeSourceData.SingleLang("Hatigarm Scans", "https://hatigarmscanz.net", "en", overrideVersionCode = 1),
ThemeSourceData.SingleLang("SecretScans", "https://secretscans.co", "en"),
SingleLang("Reaper Scans", "https://reaperscans.com", "en"),
SingleLang("Hatigarm Scans", "https://hatigarmscanz.net", "en", overrideVersionCode = 1),
SingleLang("SecretScans", "https://secretscans.co", "en"),
)

companion object {
Expand Down
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
include(":annotations")
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")

Expand Down

0 comments on commit 0ce4416

Please sign in to comment.