Skip to content

Commit

Permalink
Migrate to Gradle version catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-psi committed Jan 20, 2024
1 parent cf03864 commit 2deea47
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 95 deletions.
26 changes: 4 additions & 22 deletions AndroidCompat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,18 @@ plugins {
}

dependencies {
implementation(libs.bundles.androidcompat.implementation)
compileOnly(libs.bundles.androidcompat.compileonly)

// Android stub library
implementation(fileTree("lib/"))

// XML
compileOnly("xmlpull:xmlpull:1.1.3.4a")

// Config API
implementation(project(":AndroidCompat:Config"))

// APK sig verifier
compileOnly("com.android.tools.build:apksig:7.1.2")

// AndroidX annotations
compileOnly("androidx.annotation:annotation:1.3.0")

// substitute for duktape-android
implementation("org.mozilla:rhino-runtime:1.7.14") // slimmer version of 'org.mozilla:rhino'
implementation("org.mozilla:rhino-engine:1.7.14") // provides the same interface as 'javax.script' a.k.a Nashorn

// Kotlin wrapper around Java Preferences, makes certain things easier
val multiplatformSettingsVersion = "0.8.1"
implementation("com.russhwolf:multiplatform-settings-jvm:$multiplatformSettingsVersion")
implementation("com.russhwolf:multiplatform-settings-serialization-jvm:$multiplatformSettingsVersion")

// Android version of SimpleDateFormat
implementation("com.ibm.icu:icu4j:70.1")
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
}
}
52 changes: 6 additions & 46 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.7.21"
kotlin("plugin.serialization") version "1.7.21" apply false
id("org.jmailen.kotlinter") version "3.9.0" apply false
id("com.github.gmazzo.buildconfig") version "3.0.3" apply false
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.kotlinter) apply false
alias(libs.plugins.buildconfig) apply false
alias(libs.plugins.shadowjar) apply false
}

allprojects {
Expand Down Expand Up @@ -43,46 +43,6 @@ configure(projects) {
}

dependencies {
// Kotlin
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))

// coroutines
val coroutinesVersion = "1.6.4"
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")

val kotlinSerializationVersion = "1.4.0"
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlinSerializationVersion")

// Dependency Injection
implementation("org.kodein.di:kodein-di-conf-jvm:7.11.0")

// Logging
implementation("org.slf4j:slf4j-api:1.7.36")
implementation("ch.qos.logback:logback-classic:1.2.11")
implementation("io.github.microutils:kotlin-logging:2.1.21")

// ReactiveX
implementation("io.reactivex:rxjava:1.3.8")
implementation("io.reactivex:rxkotlin:1.0.0")

// JSoup
implementation("org.jsoup:jsoup:1.15.3")

// dependency of :AndroidCompat:Config
implementation("com.typesafe:config:1.4.2")
implementation("io.github.config4k:config4k:0.4.2")

// dex2jar
// Stuck at v64 because of https://github.com/ThexXTURBOXx/dex2jar/issues/27
val dex2jarVersion = "v64"
implementation("com.github.ThexXTURBOXx.dex2jar:dex-translator:$dex2jarVersion")
implementation("com.github.ThexXTURBOXx.dex2jar:dex-tools:$dex2jarVersion")

// APK parser
implementation("net.dongliu:apk-parser:2.6.10")
implementation(rootProject.libs.bundles.common)
}
}
122 changes: 122 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[versions]
kotlin = "1.7.21"
coroutines = "1.6.4"
serialization = "1.4.0"
dex2jar = "v64" # Stuck at v64 because of https://github.com/ThexXTURBOXx/dex2jar/issues/27
okhttp = "5.0.0-alpha.11"
rhino = "1.7.14"
multiplatform-settings = "0.8.1"

[libraries]
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }

coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "coroutines" }
coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }

serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization" }
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }

# Dependency Injection
kodein = "org.kodein.di:kodein-di-conf-jvm:7.11.0"

# Logging
slf4japi = "org.slf4j:slf4j-api:1.7.36"
logback = "ch.qos.logback:logback-classic:1.2.11"
kotlinlogging = "io.github.microutils:kotlin-logging:2.1.21"

# ReactiveX
rxjava = "io.reactivex:rxjava:1.3.8"
rxkotlin = "io.reactivex:rxkotlin:1.0.0"

# JSoup
jsoup = "org.jsoup:jsoup:1.15.3"

# Dependency of :AndroidCompat:Config
typesafe_config = "com.typesafe:config:1.4.2"
config4k = "io.github.config4k:config4k:0.4.2"

# dex2jar
dex-translator = { module = "com.github.ThexXTURBOXx.dex2jar:dex-translator", version.ref = "dex2jar" }
dex-tools = { module = "com.github.ThexXTURBOXx.dex2jar:dex-tools", version.ref = "dex2jar" }

# APK parser
apk-parser = "net.dongliu:apk-parser:2.6.10"

# OkHttp
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
okhttp-dns-over-https = { module = "com.squareup.okhttp3:okhttp-dnsoverhttps", version.ref = "okhttp" }
okio = "com.squareup.okio:okio:3.3.0"

# dependencies of Tachiyomi extensions
injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
quickjs = "app.cash.quickjs:quickjs-jvm:0.9.2"

xmlpull = "xmlpull:xmlpull:1.1.3.4a"
apksig = "com.android.tools.build:apksig:7.1.2"
androidx-annotation = "androidx.annotation:annotation:1.3.0"
rhino-runtime = { module = "org.mozilla:rhino-runtime", version.ref = "rhino" }
rhino-engine = { module = "org.mozilla:rhino-engine", version.ref = "rhino" }
multiplatform-settings-jvm = { module = "com.russhwolf:multiplatform-settings-jvm", version.ref = "multiplatform-settings" }
multiplatform-settings-serialization-jvm = { module = "com.russhwolf:multiplatform-settings-serialization-jvm", version.ref = "multiplatform-settings" }
icu4j = "com.ibm.icu:icu4j:70.1"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

# Linter
kotlinter = { id = "org.jmailen.kotlinter", version = "3.9.0" }

# Build config
buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.0.3" }

# ShadowJar
shadowjar = { id = "com.github.johnrengelman.shadow", version = "7.1.2" }

[bundles]
common = [
"kotlin-stdlib-jdk8",
"kotlin-reflect",
"coroutines-core",
"coroutines-jdk8",
"coroutines-test",
"serialization-json",
"serialization-protobuf",
"kodein",
"slf4japi",
"logback",
"kotlinlogging",
"rxjava",
"rxkotlin",
"jsoup",
"typesafe_config",
"config4k",
"dex-translator",
"dex-tools",
"apk-parser",
]
okhttp = [
"okhttp",
"okhttp-logging-interceptor",
"okhttp-dns-over-https",
"okio"
]
tachiyomi = [
"injekt-core",
"quickjs",
]
androidcompat-implementation = [
"rhino-runtime",
"rhino-engine",
"multiplatform-settings-jvm",
"multiplatform-settings-serialization-jvm",
"icu4j",
]
androidcompat-compileonly = [
"xmlpull",
"apksig",
"androidx-annotation",
]
42 changes: 15 additions & 27 deletions inspector/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,25 @@ import java.io.BufferedReader

plugins {
application
kotlin("jvm")
kotlin("plugin.serialization")
id("org.jmailen.kotlinter")
id("com.github.johnrengelman.shadow")
id("com.github.gmazzo.buildconfig")
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlinter)
alias(libs.plugins.shadowjar)
alias(libs.plugins.buildconfig)
}

dependencies {
// okhttp
val okhttpVersion = "5.0.0-alpha.11" // version is locked by Tachiyomi extensions
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
implementation("com.squareup.okio:okio:3.3.0")

// dependencies of Tachiyomi extensions, some are duplicate, keeping it here for reference
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
implementation("io.reactivex:rxjava:1.3.8")
implementation("org.jsoup:jsoup:1.15.3")
implementation("app.cash.quickjs:quickjs-jvm:0.9.2")
implementation(libs.bundles.okhttp)
implementation(libs.bundles.tachiyomi)

// AndroidCompat
implementation(project(":AndroidCompat"))
implementation(project(":AndroidCompat:Config"))

// uncomment to test extensions directly
// implementation(fileTree("lib/"))
}

@Suppress("PropertyName")
val MainClass = "inspector.MainKt"

application {
mainClass.set(MainClass)
}
Expand All @@ -56,7 +44,7 @@ val inspectorVersion = "v1.4.5"
val inspectorRevision = runCatching {
System.getenv("ProductRevision") ?: Runtime
.getRuntime()
.exec("git rev-list HEAD --count")
.exec(arrayOf("git", "rev-list", "HEAD", "--count"))
.let { process ->
process.waitFor()
val output = process.inputStream.use {
Expand Down Expand Up @@ -87,7 +75,7 @@ tasks {
mapOf(
"Main-Class" to MainClass,
"Implementation-Title" to rootProject.name,
"Implementation-Vendor" to "The Tachiyomi Open Source Project",
"Implementation-Vendor" to "The Keiyoushi Project",
"Specification-Version" to inspectorVersion,
"Implementation-Version" to inspectorRevision
)
Expand All @@ -101,10 +89,10 @@ tasks {
withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-Xopt-in=kotlin.io.path.ExperimentalPathApi",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlin.io.path.ExperimentalPathApi",
)
}
}
Expand Down

0 comments on commit 2deea47

Please sign in to comment.