2021-01-20 00:35:40 +01:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2021-05-03 19:49:09 +02:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
|
|
|
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
2021-01-21 23:07:24 +01:00
|
|
|
import java.io.BufferedReader
|
2021-01-20 00:35:40 +01:00
|
|
|
|
2020-12-23 15:22:05 +01:00
|
|
|
plugins {
|
|
|
|
application
|
2021-07-24 00:30:58 +02:00
|
|
|
kotlin("plugin.serialization")
|
2021-05-03 19:49:09 +02:00
|
|
|
id("com.github.johnrengelman.shadow") version "7.0.0"
|
|
|
|
id("org.jmailen.kotlinter") version "3.4.3"
|
2021-04-30 03:17:23 +02:00
|
|
|
id("de.fuerstenau.buildconfig") version "1.1.8"
|
2020-12-23 15:22:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-05-20 13:52:54 +02:00
|
|
|
// okhttp
|
2021-05-20 17:21:32 +02:00
|
|
|
val okhttpVersion = "4.9.1" // version is locked by Tachiyomi extensions
|
2021-04-02 00:44:40 +02:00
|
|
|
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
|
|
|
|
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
|
|
|
|
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
|
2021-05-03 19:49:09 +02:00
|
|
|
implementation("com.squareup.okio:okio:2.10.0")
|
2020-12-23 15:22:05 +01:00
|
|
|
|
2021-05-20 13:52:54 +02:00
|
|
|
|
|
|
|
// 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:4.9.1")
|
|
|
|
implementation("io.reactivex:rxjava:1.3.8")
|
|
|
|
implementation("org.jsoup:jsoup:1.13.1")
|
|
|
|
implementation("com.google.code.gson:gson:2.8.6")
|
|
|
|
implementation("com.github.salomonbrys.kotson:kotson:2.5.0")
|
|
|
|
|
|
|
|
|
|
|
|
// Source models and interfaces from Tachiyomi 1.x
|
|
|
|
// using source class from tachiyomi commit 9493577de27c40ce8b2b6122cc447d025e34c477 to not depend on tachiyomi.sourceapi
|
|
|
|
// implementation("tachiyomi.sourceapi:source-api:1.1")
|
2021-02-04 15:32:46 +01:00
|
|
|
|
2021-01-02 02:27:20 +01:00
|
|
|
// AndroidCompat
|
|
|
|
implementation(project(":AndroidCompat"))
|
|
|
|
implementation(project(":AndroidCompat:Config"))
|
|
|
|
|
2021-03-27 21:45:22 +01:00
|
|
|
// uncomment to test extensions directly
|
|
|
|
// implementation(fileTree("lib/"))
|
2021-04-03 22:42:13 +02:00
|
|
|
|
|
|
|
// Testing
|
|
|
|
testImplementation(kotlin("test-junit5"))
|
2020-12-23 15:22:05 +01:00
|
|
|
}
|
|
|
|
|
2021-06-04 10:38:20 +02:00
|
|
|
val MainClass = "suwayomi.tachidesk.MainKt"
|
2020-12-23 15:22:05 +01:00
|
|
|
application {
|
2021-05-03 19:49:09 +02:00
|
|
|
mainClass.set(MainClass)
|
2021-01-20 00:35:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
resources {
|
|
|
|
srcDir("src/main/resources")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-03 20:00:43 +02:00
|
|
|
// should be bumped with each stable release
|
2021-08-22 02:34:19 +02:00
|
|
|
val inspectorVersion = "v0.3.0"
|
2021-05-03 20:00:43 +02:00
|
|
|
|
|
|
|
// counts commit count on master
|
2021-07-31 23:06:49 +02:00
|
|
|
val inspectorRevision = runCatching {
|
2021-06-06 00:18:26 +02:00
|
|
|
System.getenv("ProductRevision") ?: Runtime
|
2021-01-21 23:07:24 +01:00
|
|
|
.getRuntime()
|
2021-05-23 15:52:35 +02:00
|
|
|
.exec("git rev-list HEAD --count")
|
2021-01-21 23:07:24 +01:00
|
|
|
.let { process ->
|
|
|
|
process.waitFor()
|
|
|
|
val output = process.inputStream.use {
|
|
|
|
it.bufferedReader().use(BufferedReader::readText)
|
|
|
|
}
|
|
|
|
process.destroy()
|
2021-02-04 21:10:40 +01:00
|
|
|
"r" + output.trim()
|
2021-01-21 23:07:24 +01:00
|
|
|
}
|
2021-05-26 00:09:25 +02:00
|
|
|
}.getOrDefault("r0")
|
2021-01-21 23:07:24 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
buildConfig {
|
|
|
|
clsName = "BuildConfig"
|
2021-05-26 23:25:21 +02:00
|
|
|
packageName = "suwayomi.server"
|
2021-05-03 19:49:09 +02:00
|
|
|
|
2021-05-25 16:53:47 +02:00
|
|
|
buildConfigField("String", "NAME", rootProject.name)
|
2021-07-31 23:06:49 +02:00
|
|
|
buildConfigField("String", "VERSION", inspectorVersion)
|
|
|
|
buildConfigField("String", "REVISION", inspectorRevision)
|
2021-05-03 19:49:09 +02:00
|
|
|
}
|
|
|
|
|
2021-01-20 00:35:40 +01:00
|
|
|
tasks {
|
2021-05-18 19:01:25 +02:00
|
|
|
shadowJar {
|
2021-01-20 00:35:40 +01:00
|
|
|
manifest {
|
|
|
|
attributes(
|
|
|
|
mapOf(
|
2021-05-03 21:45:31 +02:00
|
|
|
"Main-Class" to MainClass,
|
2021-05-03 19:49:09 +02:00
|
|
|
"Implementation-Title" to rootProject.name,
|
2021-07-31 23:06:49 +02:00
|
|
|
"Implementation-Vendor" to "The Tachiyomi Open Source Project",
|
|
|
|
"Specification-Version" to inspectorVersion,
|
|
|
|
"Implementation-Version" to inspectorRevision
|
2021-05-03 21:45:31 +02:00
|
|
|
)
|
2021-01-20 00:35:40 +01:00
|
|
|
)
|
|
|
|
}
|
2021-05-03 19:49:09 +02:00
|
|
|
archiveBaseName.set(rootProject.name)
|
2021-07-31 23:06:49 +02:00
|
|
|
archiveVersion.set(inspectorVersion)
|
|
|
|
archiveClassifier.set(inspectorRevision)
|
2021-01-20 00:35:40 +01:00
|
|
|
}
|
2021-10-09 21:03:01 +02:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
withType<KotlinCompile> {
|
2021-04-01 22:07:35 +02:00
|
|
|
kotlinOptions {
|
|
|
|
freeCompilerArgs = listOf(
|
2021-05-03 21:45:31 +02:00
|
|
|
"-Xopt-in=kotlin.RequiresOptIn",
|
|
|
|
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
|
|
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
|
2021-04-01 22:07:35 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2021-05-18 19:08:41 +02:00
|
|
|
|
2021-04-03 22:42:13 +02:00
|
|
|
test {
|
|
|
|
useJUnit()
|
|
|
|
}
|
2021-05-18 19:01:25 +02:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
withType<ShadowJar> {
|
|
|
|
destinationDirectory.set(File("$rootDir/server/build"))
|
|
|
|
dependsOn("formatKotlin", "lintKotlin")
|
|
|
|
}
|
2021-01-22 10:04:03 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
named("run") {
|
|
|
|
dependsOn("formatKotlin", "lintKotlin")
|
|
|
|
}
|
2021-04-13 08:23:23 +02:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
withType<LintTask> {
|
2021-05-19 14:33:12 +02:00
|
|
|
source(files("src/kotlin"))
|
2021-05-03 19:49:09 +02:00
|
|
|
}
|
2021-01-22 10:04:03 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
withType<FormatTask> {
|
2021-05-19 14:33:12 +02:00
|
|
|
source(files("src/kotlin"))
|
2021-05-03 19:49:09 +02:00
|
|
|
}
|
2021-07-24 00:30:58 +02:00
|
|
|
|
|
|
|
withType<ProcessResources> {
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.WARN
|
|
|
|
}
|
2021-04-30 03:17:23 +02:00
|
|
|
}
|