141 lines
4.0 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("jvm")
kotlin("plugin.serialization")
id("org.jmailen.kotlinter")
id("com.github.johnrengelman.shadow")
id("com.github.gmazzo.buildconfig")
}
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")
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:$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
// 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
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
}
}.getOrDefault("r0")
2021-01-22 01:37:24 +03:30
val String.wrapped get() = """"$this""""
buildConfig {
className("BuildConfig")
packageName("suwayomi.server")
useKotlinOutput()
buildConfigField("String", "NAME", rootProject.name.wrapped)
buildConfigField("String", "VERSION", inspectorVersion.wrapped)
buildConfigField("String", "REVISION", inspectorRevision.wrapped)
}
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(
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()
}
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
}