2021-01-20 03:05:40 +03:30
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2021-05-03 13:49:09 -04:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
|
|
|
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
2021-01-22 01:37:24 +03:30
|
|
|
import java.io.BufferedReader
|
2021-01-20 03:05:40 +03:30
|
|
|
|
2020-12-23 17:52:05 +03:30
|
|
|
plugins {
|
|
|
|
application
|
2022-04-02 10:03:58 -04:00
|
|
|
kotlin("jvm")
|
2021-07-23 18:30:58 -04:00
|
|
|
kotlin("plugin.serialization")
|
2022-04-02 10:03:58 -04:00
|
|
|
id("org.jmailen.kotlinter")
|
|
|
|
id("com.github.johnrengelman.shadow")
|
|
|
|
id("com.github.gmazzo.buildconfig")
|
2020-12-23 17:52:05 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-05-20 16:22:54 +04:30
|
|
|
// okhttp
|
2023-02-07 17:56:49 -05:00
|
|
|
val okhttpVersion = "5.0.0-alpha.11" // version is locked by Tachiyomi extensions
|
2021-04-02 03:14:40 +04:30
|
|
|
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
|
|
|
|
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
|
|
|
|
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
|
2023-02-07 17:56:49 -05:00
|
|
|
implementation("com.squareup.okio:okio:3.3.0")
|
2020-12-23 17:52:05 +03:30
|
|
|
|
2021-05-20 16:22:54 +04:30
|
|
|
|
|
|
|
// dependencies of Tachiyomi extensions, some are duplicate, keeping it here for reference
|
|
|
|
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
|
2022-04-02 10:03:58 -04:00
|
|
|
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
|
2021-05-20 16:22:54 +04:30
|
|
|
implementation("io.reactivex:rxjava:1.3.8")
|
2023-02-07 17:56:49 -05:00
|
|
|
implementation("org.jsoup:jsoup:1.15.3")
|
2022-04-02 10:48:12 -04:00
|
|
|
implementation("app.cash.quickjs:quickjs-jvm:0.9.2")
|
2021-05-20 16:22:54 +04:30
|
|
|
|
2021-01-02 04:57:20 +03:30
|
|
|
// AndroidCompat
|
|
|
|
implementation(project(":AndroidCompat"))
|
|
|
|
implementation(project(":AndroidCompat:Config"))
|
|
|
|
|
2021-03-28 01:15:22 +04:30
|
|
|
// uncomment to test extensions directly
|
|
|
|
// implementation(fileTree("lib/"))
|
2021-04-03 16:42:13 -04:00
|
|
|
|
|
|
|
// Testing
|
|
|
|
testImplementation(kotlin("test-junit5"))
|
2020-12-23 17:52:05 +03:30
|
|
|
}
|
|
|
|
|
2021-06-04 13:08:20 +04:30
|
|
|
val MainClass = "suwayomi.tachidesk.MainKt"
|
2020-12-23 17:52:05 +03:30
|
|
|
application {
|
2021-05-03 13:49:09 -04:00
|
|
|
mainClass.set(MainClass)
|
2021-01-20 03:05:40 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
resources {
|
|
|
|
srcDir("src/main/resources")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-03 22:30:43 +04:30
|
|
|
// should be bumped with each stable release
|
2023-09-02 23:22:37 -04:00
|
|
|
val inspectorVersion = "v1.4.3"
|
2021-05-03 22:30:43 +04:30
|
|
|
|
|
|
|
// counts commit count on master
|
2021-07-31 17:06:49 -04:00
|
|
|
val inspectorRevision = runCatching {
|
2021-06-06 02:48:26 +04:30
|
|
|
System.getenv("ProductRevision") ?: Runtime
|
2021-01-22 01:37:24 +03:30
|
|
|
.getRuntime()
|
2021-05-23 18:22:35 +04:30
|
|
|
.exec("git rev-list HEAD --count")
|
2021-01-22 01:37:24 +03:30
|
|
|
.let { process ->
|
|
|
|
process.waitFor()
|
|
|
|
val output = process.inputStream.use {
|
|
|
|
it.bufferedReader().use(BufferedReader::readText)
|
|
|
|
}
|
|
|
|
process.destroy()
|
2021-02-04 23:40:40 +03:30
|
|
|
"r" + output.trim()
|
2021-01-22 01:37:24 +03:30
|
|
|
}
|
2021-05-25 18:09:25 -04:00
|
|
|
}.getOrDefault("r0")
|
2021-01-22 01:37:24 +03:30
|
|
|
|
2022-04-02 10:03:58 -04:00
|
|
|
val String.wrapped get() = """"$this""""
|
|
|
|
|
2021-05-03 13:49:09 -04:00
|
|
|
buildConfig {
|
2022-04-02 10:03:58 -04:00
|
|
|
className("BuildConfig")
|
|
|
|
packageName("suwayomi.server")
|
|
|
|
|
|
|
|
useKotlinOutput()
|
2021-05-03 13:49:09 -04:00
|
|
|
|
2022-04-02 10:03:58 -04:00
|
|
|
buildConfigField("String", "NAME", rootProject.name.wrapped)
|
|
|
|
buildConfigField("String", "VERSION", inspectorVersion.wrapped)
|
|
|
|
buildConfigField("String", "REVISION", inspectorRevision.wrapped)
|
2021-05-03 13:49:09 -04:00
|
|
|
}
|
|
|
|
|
2021-01-20 03:05:40 +03:30
|
|
|
tasks {
|
2021-05-18 21:31:25 +04:30
|
|
|
shadowJar {
|
2021-01-20 03:05:40 +03:30
|
|
|
manifest {
|
|
|
|
attributes(
|
|
|
|
mapOf(
|
2021-05-04 00:15:31 +04:30
|
|
|
"Main-Class" to MainClass,
|
2021-05-03 13:49:09 -04:00
|
|
|
"Implementation-Title" to rootProject.name,
|
2021-07-31 17:06:49 -04:00
|
|
|
"Implementation-Vendor" to "The Tachiyomi Open Source Project",
|
|
|
|
"Specification-Version" to inspectorVersion,
|
|
|
|
"Implementation-Version" to inspectorRevision
|
2021-05-04 00:15:31 +04:30
|
|
|
)
|
2021-01-20 03:05:40 +03:30
|
|
|
)
|
|
|
|
}
|
2021-05-03 13:49:09 -04:00
|
|
|
archiveBaseName.set(rootProject.name)
|
2021-07-31 17:06:49 -04:00
|
|
|
archiveVersion.set(inspectorVersion)
|
|
|
|
archiveClassifier.set(inspectorRevision)
|
2021-01-20 03:05:40 +03:30
|
|
|
}
|
2021-10-09 15:03:01 -04:00
|
|
|
|
2021-05-03 13:49:09 -04:00
|
|
|
withType<KotlinCompile> {
|
2021-04-01 16:07:35 -04:00
|
|
|
kotlinOptions {
|
|
|
|
freeCompilerArgs = listOf(
|
2023-09-02 23:22:37 -04:00
|
|
|
"-Xopt-in=kotlin.RequiresOptIn",
|
|
|
|
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
|
|
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
|
|
|
"-Xopt-in=kotlin.io.path.ExperimentalPathApi",
|
2021-04-01 16:07:35 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2021-05-18 21:38:41 +04:30
|
|
|
|
2021-04-03 16:42:13 -04:00
|
|
|
test {
|
|
|
|
useJUnit()
|
|
|
|
}
|
2021-05-18 21:31:25 +04:30
|
|
|
|
2021-05-03 13:49:09 -04:00
|
|
|
withType<ShadowJar> {
|
|
|
|
destinationDirectory.set(File("$rootDir/server/build"))
|
|
|
|
dependsOn("formatKotlin", "lintKotlin")
|
|
|
|
}
|
2021-01-22 12:34:03 +03:30
|
|
|
|
2021-05-03 13:49:09 -04:00
|
|
|
named("run") {
|
|
|
|
dependsOn("formatKotlin", "lintKotlin")
|
|
|
|
}
|
2021-04-13 10:53:23 +04:30
|
|
|
|
2021-05-03 13:49:09 -04:00
|
|
|
withType<LintTask> {
|
2021-05-19 17:03:12 +04:30
|
|
|
source(files("src/kotlin"))
|
2021-05-03 13:49:09 -04:00
|
|
|
}
|
2021-01-22 12:34:03 +03:30
|
|
|
|
2021-05-03 13:49:09 -04:00
|
|
|
withType<FormatTask> {
|
2021-05-19 17:03:12 +04:30
|
|
|
source(files("src/kotlin"))
|
2021-05-03 13:49:09 -04:00
|
|
|
}
|
2021-07-23 18:30:58 -04:00
|
|
|
|
|
|
|
withType<ProcessResources> {
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.WARN
|
|
|
|
}
|
2021-04-29 19:17:23 -06:00
|
|
|
}
|