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-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
|
|
|
}
|
|
|
|
|
|
|
|
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")
|
|
|
|
}
|
2020-12-23 15:22:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-05-20 13:52:54 +02:00
|
|
|
// okhttp
|
|
|
|
val okhttpVersion = "4.9.1" // version is locked by 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
|
|
|
// Javalin api
|
2021-05-03 19:49:09 +02:00
|
|
|
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
|
2021-05-03 19:49:09 +02:00
|
|
|
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
|
2021-05-03 19:49:09 +02:00
|
|
|
implementation("com.h2database:h2:1.4.200")
|
2021-02-03 22:02:01 +01:00
|
|
|
|
2021-02-04 15:32:46 +01:00
|
|
|
// tray icon
|
2021-05-03 19:49:09 +02:00
|
|
|
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
|
|
|
|
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-05-17 00:18:01 +02:00
|
|
|
val MainClass = "ir.armor.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-05-19 01:22:55 +02:00
|
|
|
val tachideskVersion = "v0.3.7"
|
2021-05-03 20:00:43 +02:00
|
|
|
|
|
|
|
// counts commit count on master
|
|
|
|
val tachideskRevision = Runtime
|
2021-01-21 23:07:24 +01:00
|
|
|
.getRuntime()
|
|
|
|
.exec("git rev-list master --count")
|
|
|
|
.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-03 19:49:09 +02:00
|
|
|
buildConfig {
|
|
|
|
appName = rootProject.name
|
|
|
|
clsName = "BuildConfig"
|
|
|
|
packageName = "ir.armor.tachidesk.server"
|
2021-05-03 20:00:43 +02:00
|
|
|
version = tachideskVersion
|
2021-05-03 19:49:09 +02:00
|
|
|
|
|
|
|
|
2021-05-03 20:00:43 +02:00
|
|
|
buildConfigField("String", "name", rootProject.name) // alias for BuildConfig.NAME
|
|
|
|
buildConfigField("String", "version", tachideskVersion) // alias for BuildConfig.VERSION
|
|
|
|
buildConfigField("String", "revision", tachideskRevision)
|
2021-05-03 19:49:09 +02:00
|
|
|
buildConfigField("boolean", "debug", project.hasProperty("debugApp").toString())
|
|
|
|
}
|
|
|
|
|
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-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
|
|
|
)
|
|
|
|
}
|
2021-05-03 19:49:09 +02: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
|
|
|
}
|
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
|
|
|
named<Copy>("processResources") {
|
2021-05-03 21:21:48 +02:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
2021-05-03 19:49:09 +02:00
|
|
|
mustRunAfter(":webUI:copyBuild")
|
|
|
|
}
|
2021-01-22 10:04:03 +01: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-04-30 03:17:23 +02:00
|
|
|
}
|