141 lines
4.2 KiB
Plaintext
Raw Normal View History

2021-01-20 03:05:40 +03:30
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
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
plugins {
application
kotlin("plugin.serialization")
id("com.github.johnrengelman.shadow") version "7.0.0"
id("org.jmailen.kotlinter") version "3.4.3"
2021-04-29 19:17:23 -06:00
id("de.fuerstenau.buildconfig") version "1.1.8"
}
dependencies {
2021-05-20 16:22:54 +04:30
// okhttp
2021-05-20 19:51:32 +04:30
val okhttpVersion = "4.9.1" // 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")
implementation("com.squareup.okio:okio:2.10.0")
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")
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 18:02:46 +03:30
// AndroidCompat
implementation(project(":AndroidCompat"))
implementation(project(":AndroidCompat:Config"))
// uncomment to test extensions directly
// implementation(fileTree("lib/"))
2021-04-03 16:42:13 -04:00
// Testing
testImplementation(kotlin("test-junit5"))
}
val MainClass = "suwayomi.tachidesk.MainKt"
application {
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
2021-08-21 20:34:19 -04:00
val inspectorVersion = "v0.3.0"
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
}
}.getOrDefault("r0")
2021-01-22 01:37:24 +03:30
buildConfig {
clsName = "BuildConfig"
2021-05-27 01:55:21 +04:30
packageName = "suwayomi.server"
2021-05-25 19:23:47 +04:30
buildConfigField("String", "NAME", rootProject.name)
2021-07-31 17:06:49 -04:00
buildConfigField("String", "VERSION", inspectorVersion)
buildConfigField("String", "REVISION", inspectorRevision)
}
2021-01-20 03:05:40 +03:30
tasks {
shadowJar {
2021-01-20 03:05:40 +03:30
manifest {
attributes(
mapOf(
2021-05-04 00:15:31 +04:30
"Main-Class" to MainClass,
"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
)
}
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
withType<KotlinCompile> {
2021-04-01 16:07:35 -04:00
kotlinOptions {
freeCompilerArgs = listOf(
2021-05-04 00:15:31 +04:30
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
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()
}
withType<ShadowJar> {
destinationDirectory.set(File("$rootDir/server/build"))
dependsOn("formatKotlin", "lintKotlin")
}
2021-01-22 12:34:03 +03:30
named("run") {
dependsOn("formatKotlin", "lintKotlin")
}
withType<LintTask> {
source(files("src/kotlin"))
}
2021-01-22 12:34:03 +03:30
withType<FormatTask> {
source(files("src/kotlin"))
}
withType<ProcessResources> {
duplicatesStrategy = DuplicatesStrategy.WARN
}
2021-04-29 19:17:23 -06:00
}