Skip to content

Commit

Permalink
GraphQL Conversion (#3)
Browse files Browse the repository at this point in the history
* Implement graphql library

* Fix Okhttp dependency

* Initial GraphQL Conversion

* Full GraphQL conversion

* Fix github actions

* Update Jvm Target

* Manually set 1.8 target

* Move some filters to GraphQL
  • Loading branch information
Syer10 authored Jun 8, 2024
1 parent 1e8d47b commit 5123653
Show file tree
Hide file tree
Showing 23 changed files with 3,884 additions and 353 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: adopt

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build extensions
uses: gradle/gradle-build-action@v2
with:
arguments: assembleDebug
cache-read-only: true
run: ./gradlew assembleDebug
9 changes: 5 additions & 4 deletions .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: adopt

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Prepare signing key
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
- name: Build extensions (chunk ${{ matrix.chunk }})
uses: gradle/gradle-build-action@v2
env:
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
with:
arguments: assembleRelease
run: ./gradlew assembleRelease

- name: Upload APKs
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {
classpath(libs.gradle.kotlin)
classpath(libs.gradle.serialization)
classpath(libs.gradle.kotlinter)
classpath(libs.gradle.apollo)
}
}

Expand Down
1 change: 0 additions & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ android {

namespace = "eu.kanade.tachiyomi.extension"

@Suppress("UnstableApiUsage")
sourceSets {
named("main") {
manifest.srcFile("AndroidManifest.xml")
Expand Down
10 changes: 7 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[versions]
kotlin_version = "1.7.21"
kotlin_version = "1.9.20"
coroutines_version = "1.6.4"
serialization_version = "1.4.0"
apollo = "3.8.3"

[libraries]
gradle-agp = { module = "com.android.tools.build:gradle", version = "7.4.2" }
gradle-agp = { module = "com.android.tools.build:gradle", version = "8.3.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.13.0" }
gradle-apollo = { module = "com.apollographql.apollo3:apollo-gradle-plugin", version.ref = "apollo" }

tachiyomi-lib = { module = "com.github.tachiyomiorg:extensions-lib", version = "1.4.2" }

kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin_version" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin_version" }
kotlin-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
kotlin-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization_version" }

Expand All @@ -24,5 +26,7 @@ jsoup = { module = "org.jsoup:jsoup", version = "1.15.1" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" }
quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }

apollo-runtime = { module = "com.apollographql.apollo3:apollo-runtime", version.ref = "apollo" }

[bundles]
common = ["kotlin-stdlib", "coroutines-core", "coroutines-android", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "tachiyomi-lib", "quickjs"]
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
19 changes: 12 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# 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"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
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
# 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
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +198,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# 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"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
9 changes: 9 additions & 0 deletions lib/cryptoaes/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ android {
}

namespace = "eu.kanade.tachiyomi.lib.cryptoaes"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
Expand Down
9 changes: 9 additions & 0 deletions lib/dataimage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ android {
}

namespace = "eu.kanade.tachiyomi.lib.dataimage"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
Expand Down
9 changes: 9 additions & 0 deletions lib/i18n/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ android {
}

namespace = "eu.kanade.tachiyomi.lib.i18n"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
Expand Down
9 changes: 9 additions & 0 deletions lib/randomua/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ android {
}

namespace = "eu.kanade.tachiyomi.lib.randomua"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
Expand Down
9 changes: 9 additions & 0 deletions lib/synchrony/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ android {
}

namespace = "eu.kanade.tachiyomi.lib.synchrony"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
Expand Down
9 changes: 9 additions & 0 deletions lib/textinterceptor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ android {
}

namespace = "eu.kanade.tachiyomi.lib.textinterceptor"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
Expand Down
33 changes: 32 additions & 1 deletion src/all/tachidesk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
apply plugin: 'com.apollographql.apollo3'

ext {
extName = 'Suwayomi'
pkgNameSuffix = 'all.tachidesk'
extClass = '.Tachidesk'
extVersionCode = 12
extVersionCode = 13
}

apply from: "$rootDir/common.gradle"

apollo {
service("service") {
packageName.set("eu.kanade.tachiyomi.extension.all.tachidesk.apollo")
srcDir("graphql")
mapScalar("LongString","kotlin.Long", "eu.kanade.tachiyomi.extension.all.tachidesk.LongStringScalar")

introspection {
endpointUrl.set("http://localhost:4567/api/graphql")
schemaFile.set(file("graphql/schema.graphqls"))
}
}
}

dependencies {
implementation(libs.apollo.runtime) {
exclude group: 'com.squareup.okhttp3'
exclude group: 'com.squareup.okio'
exclude group: 'org.jetbrains.kotlin'
exclude group: 'org.jetbrains.kotlinx'
}
}

configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.squareup.okhttp3' && details.requested.name == 'okhttp' && details.requested.version == '4.9.3') {
details.useVersion libs.okhttp.get().version
}
}
}
12 changes: 12 additions & 0 deletions src/all/tachidesk/graphql/Category.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fragment CategoryFragment on CategoryType {
id
name
}

query GetCategories {
categories(orderBy: ORDER) {
nodes {
...CategoryFragment
}
}
}
32 changes: 32 additions & 0 deletions src/all/tachidesk/graphql/Chapter.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
fragment ChapterFragment on ChapterType {
id
url
chapterNumber
name
uploadDate
scanlator
sourceOrder
mangaId
}

mutation GetChapters($mangaId: Int!) {
fetchChapters(input: {mangaId: $mangaId}) {
chapters {
...ChapterFragment
}
}
}

query GetChapterId($mangaId: Int!, $chapterSourceorder: Int!) {
chapters(condition: {mangaId: $mangaId, sourceOrder: $chapterSourceorder}) {
nodes {
id
}
}
}

mutation GetPages($chapterId: Int!) {
fetchChapterPages(input: {chapterId: $chapterId}) {
pages
}
}
37 changes: 37 additions & 0 deletions src/all/tachidesk/graphql/Manga.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
fragment MangaFragment on MangaType {
artist
author
description
id
status
thumbnailUrl
title
url
genre
inLibraryAt
chapters {
totalCount
}
}

mutation GetManga($mangaId: Int!) {
fetchManga(input: {id: $mangaId}) {
manga {
...MangaFragment
}
}
}

query SearchManga($categories: [Int!]!, $filter: [MangaFilterInput!]) {
mangas(
condition: {inLibrary: true},
filter: {
categoryId: {in: $categories},
and: $filter
}
) {
nodes {
...MangaFragment
}
}
}
Loading

0 comments on commit 5123653

Please sign in to comment.