tachiyomi-extensions-inspector/server/build.gradle.kts

182 lines
5.7 KiB
Plaintext
Raw Normal View History

2021-01-20 00:35:40 +01:00
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-21 23:07:24 +01:00
import java.io.BufferedReader
2021-05-25 18:36:27 +02:00
import java.time.Instant
2021-01-20 00:35:40 +01:00
plugins {
application
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"
}
repositories {
2021-05-19 14:06:17 +02:00
maven {
url = uri("https://repo1.maven.org/maven2/")
}
2021-01-01 23:40:37 +01:00
maven {
url = uri("https://jitpack.io")
}
}
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")
implementation("com.squareup.okio:okio:2.10.0")
2021-05-20 13:52:54 +02:00
// Javalin api
implementation("io.javalin:javalin:3.13.6")
2021-05-19 14:06:17 +02:00
// jackson version is tied to javalin, ref: `io.javalin.core.util.OptionalDependency`
implementation("com.fasterxml.jackson.core:jackson-databind:2.10.3")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.10.3")
2020-12-23 23:38:03 +01:00
2020-12-24 17:07:27 +01:00
// Exposed ORM
val exposedVersion = "0.31.1"
2021-04-02 00:44:40 +02:00
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
2021-05-06 16:14:46 +02:00
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
// current database driver
implementation("com.h2database:h2:1.4.200")
2021-02-04 15:32:46 +01:00
// tray icon
implementation("com.dorkbox:SystemTray:4.1")
implementation("com.dorkbox:Utilities:1.9")
2021-02-04 15:32:46 +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
// AndroidCompat
implementation(project(":AndroidCompat"))
implementation(project(":AndroidCompat:Config"))
// uncomment to test extensions directly
// implementation(fileTree("lib/"))
2021-04-03 22:42:13 +02:00
// Testing
testImplementation(kotlin("test-junit5"))
}
val MainClass = "suwayomi.tachidesk.MainKt"
application {
mainClass.set(MainClass)
2021-05-24 13:07:25 +02:00
// for testing electron
// applicationDefaultJvmArgs = listOf(
2021-05-26 23:25:21 +02:00
// "-Dsuwayomi.tachidesk.webInterface=electron",
// "-Dsuwayomi.tachidesk.electronPath=/usr/bin/electron"
2021-05-24 13:07:25 +02:00
// )
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-05-30 01:34:11 +02:00
val tachideskVersion = "v0.4.2"
2021-05-03 20:00:43 +02:00
// counts commit count on master
val tachideskRevision = runCatching {
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
}
}.getOrDefault("r0")
2021-01-21 23:07:24 +01:00
buildConfig {
clsName = "BuildConfig"
2021-05-26 23:25:21 +02:00
packageName = "suwayomi.server"
2021-05-25 16:53:47 +02:00
buildConfigField("String", "NAME", rootProject.name)
buildConfigField("String", "VERSION", tachideskVersion)
buildConfigField("String", "REVISION", tachideskRevision)
buildConfigField("String", "BUILD_TYPE", if (System.getenv("TachideskBuildType") == "Stable") "Stable" else "Preview")
2021-05-25 18:36:27 +02:00
buildConfigField("long", "BUILD_TIME", Instant.now().epochSecond.toString())
buildConfigField("String", "GITHUB", "https://github.com/Suwayomi/Tachidesk")
buildConfigField("String", "DISCORD", "https://discord.gg/DDZdqZWaHA")
}
2021-01-20 00:35:40 +01:00
tasks {
shadowJar {
2021-01-20 00:35:40 +01:00
manifest {
attributes(
mapOf(
2021-05-03 21:45:31 +02:00
"Main-Class" to MainClass,
"Implementation-Title" to rootProject.name,
2021-05-03 21:45:31 +02:00
"Implementation-Vendor" to "The Suwayomi Project",
"Specification-Version" to tachideskVersion,
"Implementation-Version" to tachideskRevision
)
2021-01-20 00:35:40 +01:00
)
}
archiveBaseName.set(rootProject.name)
2021-05-03 20:00:43 +02:00
archiveVersion.set(tachideskVersion)
archiveClassifier.set(tachideskRevision)
2021-01-20 00:35:40 +01: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()
}
withType<ShadowJar> {
destinationDirectory.set(File("$rootDir/server/build"))
dependsOn("formatKotlin", "lintKotlin")
}
2021-01-22 10:04:03 +01:00
named("run") {
dependsOn("formatKotlin", "lintKotlin")
}
named<Copy>("processResources") {
2021-05-03 21:21:48 +02:00
duplicatesStrategy = DuplicatesStrategy.INCLUDE
mustRunAfter(":webUI:copyBuild")
}
2021-01-22 10:04:03 +01:00
withType<LintTask> {
source(files("src/kotlin"))
}
2021-01-22 10:04:03 +01:00
withType<FormatTask> {
source(files("src/kotlin"))
}
2021-04-30 03:17:23 +02:00
}