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"
|
|
|
|
id("edu.sc.seis.launch4j") version "2.5.0"
|
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 {
|
|
|
|
mavenCentral()
|
2021-01-01 23:40:37 +01:00
|
|
|
maven {
|
|
|
|
url = uri("https://jitpack.io")
|
|
|
|
}
|
2020-12-23 15:22:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
// 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-01-01 23:40:37 +01:00
|
|
|
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
|
2020-12-23 15:22:05 +01:00
|
|
|
|
2021-04-02 00:44:40 +02:00
|
|
|
val okhttpVersion = "4.10.0-RC1"
|
|
|
|
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
|
|
|
|
2020-12-23 15:52:43 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
// Retrofit
|
2021-04-02 00:44:40 +02:00
|
|
|
val retrofitVersion = "2.9.0"
|
|
|
|
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
|
2020-12-23 17:22:16 +01:00
|
|
|
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")
|
2021-04-02 00:44:40 +02:00
|
|
|
implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion")
|
|
|
|
implementation("com.squareup.retrofit2:adapter-rxjava:$retrofitVersion")
|
2020-12-23 15:52:43 +01:00
|
|
|
|
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
// Reactivex
|
2020-12-23 15:22:05 +01:00
|
|
|
implementation("io.reactivex:rxjava:1.3.8")
|
|
|
|
|
2021-05-06 16:14:46 +02:00
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
|
2020-12-23 15:22:05 +01:00
|
|
|
implementation("com.google.code.gson:gson:2.8.6")
|
2020-12-23 17:22:16 +01:00
|
|
|
implementation("com.github.salomonbrys.kotson:kotson:2.5.0")
|
2020-12-23 15:52:43 +01:00
|
|
|
|
|
|
|
implementation("org.jsoup:jsoup:1.13.1")
|
2020-12-23 15:22:05 +01:00
|
|
|
implementation("com.github.salomonbrys.kotson:kotson:2.5.0")
|
|
|
|
|
2020-12-23 21:57:19 +01:00
|
|
|
|
2020-12-23 23:38:03 +01:00
|
|
|
// api
|
2021-05-03 19:49:09 +02:00
|
|
|
implementation("io.javalin:javalin:3.13.6")
|
|
|
|
implementation("com.fasterxml.jackson.core:jackson-databind:2.12.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-06 16:14:46 +02:00
|
|
|
implementation("com.google.guava:guava:30.1.1-jre")
|
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-03 19:49:09 +02:00
|
|
|
val MainClass = "ir.armor.tachidesk.Main"
|
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-15 20:54:25 +02:00
|
|
|
val tachideskVersion = "v0.3.2"
|
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())
|
|
|
|
}
|
|
|
|
|
|
|
|
launch4j { //used for windows
|
|
|
|
mainClassName = MainClass
|
|
|
|
bundledJrePath = "jre"
|
|
|
|
bundledJre64Bit = true
|
|
|
|
jreMinVersion = "8"
|
2021-05-16 10:09:05 +02:00
|
|
|
outputDir = "${rootProject.name}-$tachideskVersion-$tachideskRevision-win64"
|
2021-05-03 19:49:09 +02:00
|
|
|
icon = "${projectDir}/src/main/resources/icon/faviconlogo.ico"
|
2021-05-03 20:00:43 +02:00
|
|
|
jar = "${projectDir}/build/${rootProject.name}-$tachideskVersion-$tachideskRevision.jar"
|
2021-05-03 19:49:09 +02:00
|
|
|
}
|
|
|
|
|
2021-01-20 00:35:40 +01:00
|
|
|
tasks {
|
|
|
|
jar {
|
|
|
|
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
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
shadowJar {
|
|
|
|
manifest.inheritFrom(jar.get().manifest) //will make your shadowJar (produced by jar task) runnable
|
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-04-03 22:42:13 +02:00
|
|
|
test {
|
|
|
|
useJUnit()
|
|
|
|
}
|
2021-02-04 21:10:40 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
register<Zip>("windowsPackage") {
|
2021-05-16 10:09:05 +02:00
|
|
|
from(fileTree("$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64"))
|
2021-05-03 19:49:09 +02:00
|
|
|
destinationDirectory.set(File("$buildDir"))
|
2021-05-16 10:09:05 +02:00
|
|
|
archiveFileName.set("${rootProject.name}-$tachideskVersion-$tachideskRevision-win64.zip")
|
2021-05-03 19:49:09 +02:00
|
|
|
dependsOn("windowsPackageWorkaround2")
|
|
|
|
}
|
2021-02-04 21:10:40 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
register<Delete>("windowsPackageWorkaround2") {
|
|
|
|
delete(
|
2021-05-16 10:09:05 +02:00
|
|
|
"$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64/jre",
|
|
|
|
"$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64/lib",
|
|
|
|
"$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64/server.exe",
|
|
|
|
"$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64/Tachidesk-$tachideskVersion-$tachideskRevision-win64/Tachidesk-$tachideskVersion-$tachideskRevision-win64"
|
2021-05-03 19:49:09 +02:00
|
|
|
)
|
|
|
|
dependsOn("windowsPackageWorkaround")
|
|
|
|
}
|
2021-02-04 21:10:40 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
register<Copy>("windowsPackageWorkaround") {
|
2021-05-16 10:09:05 +02:00
|
|
|
from("$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64")
|
|
|
|
into("$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64")
|
2021-05-03 19:49:09 +02:00
|
|
|
dependsOn("deleteUnwantedJreDir")
|
|
|
|
}
|
2021-02-04 21:10:40 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
register<Delete>("deleteUnwantedJreDir") {
|
|
|
|
delete(
|
2021-05-16 10:09:05 +02:00
|
|
|
"$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64/jdk8u292-b10-jre"
|
2021-05-03 19:49:09 +02:00
|
|
|
)
|
|
|
|
dependsOn("addJreToDistributable")
|
2021-02-04 21:10:40 +01:00
|
|
|
}
|
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
register<Copy>("addJreToDistributable") {
|
2021-05-16 10:09:05 +02:00
|
|
|
from(zipTree("$buildDir/OpenJDK8U-jre_x64_windows_hotspot_8u292b10.zip"))
|
|
|
|
into("$buildDir/${rootProject.name}-$tachideskVersion-$tachideskRevision-win64")
|
2021-05-03 19:49:09 +02:00
|
|
|
eachFile {
|
2021-05-03 21:45:31 +02:00
|
|
|
path = path.replace(".*-jre".toRegex(), "jre")
|
2021-05-03 19:49:09 +02:00
|
|
|
}
|
|
|
|
dependsOn("downloadJre")
|
|
|
|
dependsOn("createExe")
|
|
|
|
}
|
2021-02-04 21:10:40 +01:00
|
|
|
|
2021-05-03 21:21:48 +02:00
|
|
|
named("createExe") {
|
|
|
|
dependsOn("shadowJar")
|
|
|
|
}
|
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
register<de.undercouch.gradle.tasks.download.Download>("downloadJre") {
|
2021-05-16 10:09:05 +02:00
|
|
|
src("https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jre_x64_windows_hotspot_8u292b10.zip")
|
|
|
|
dest("$buildDir/OpenJDK8U-jre_x64_windows_hotspot_8u292b10.zip")
|
2021-05-03 19:49:09 +02:00
|
|
|
overwrite(false)
|
|
|
|
onlyIfModified(true)
|
|
|
|
}
|
2021-01-20 00:35:40 +01: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> {
|
|
|
|
source(files("src"))
|
|
|
|
}
|
2021-01-22 10:04:03 +01:00
|
|
|
|
2021-05-03 19:49:09 +02:00
|
|
|
withType<FormatTask> {
|
|
|
|
source(files("src"))
|
|
|
|
}
|
2021-04-30 03:17:23 +02:00
|
|
|
}
|
2021-05-03 19:49:09 +02:00
|
|
|
|