Update everything (#68)

* Update everything, cleanup build.gradle.kts's

* Make requested changes
This commit is contained in:
Syer10 2021-05-03 13:49:09 -04:00 committed by GitHub
parent 773120c96a
commit 5f4c7454ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 143 additions and 143 deletions

View File

@ -6,7 +6,6 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
maven { maven {
url = uri("https://jitpack.io") url = uri("https://jitpack.io")
} }

View File

@ -1,8 +1,7 @@
import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("org.jetbrains.kotlin.jvm") version "1.4.21" apply false // Also in buildSrc Config.kt kotlin("jvm") version "1.4.32"
id("java")
} }
allprojects { allprojects {
@ -11,7 +10,6 @@ allprojects {
version = "1.0" version = "1.0"
repositories { repositories {
jcenter()
mavenCentral() mavenCentral()
maven("https://maven.google.com/") maven("https://maven.google.com/")
maven("https://jitpack.io") maven("https://jitpack.io")
@ -28,7 +26,6 @@ val projects = listOf(
) )
configure(projects) { configure(projects) {
apply(plugin = "java")
apply(plugin = "org.jetbrains.kotlin.jvm") apply(plugin = "org.jetbrains.kotlin.jvm")
java { java {
@ -36,33 +33,32 @@ configure(projects) {
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { tasks.withType<KotlinCompile> {
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = JavaVersion.VERSION_1_8.toString()
} }
} }
dependencies { dependencies {
// Kotlin // Kotlin
implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) implementation(kotlin("stdlib"))
implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) implementation(kotlin("reflect"))
implementation(kotlin("reflect", version = "1.4.21")) testImplementation(kotlin("test"))
testImplementation(kotlin("test", version = "1.4.21"))
// coroutines // coroutines
val coroutinesVersion = "1.4.2" val coroutinesVersion = "1.4.3"
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
// Dependency Injection // Dependency Injection
implementation("org.kodein.di:kodein-di-conf-jvm:7.1.0") implementation("org.kodein.di:kodein-di-conf-jvm:7.5.0")
// Logging // Logging
implementation("org.slf4j:slf4j-api:1.7.30") implementation("org.slf4j:slf4j-api:1.7.30")
implementation("ch.qos.logback:logback-classic:1.2.3") implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("io.github.microutils:kotlin-logging:2.0.3") implementation("io.github.microutils:kotlin-logging:2.0.6")
// RxJava // RxJava
implementation("io.reactivex:rxjava:1.3.8") implementation("io.reactivex:rxjava:1.3.8")
@ -73,11 +69,11 @@ configure(projects) {
// dependency of :AndroidCompat:Config // dependency of :AndroidCompat:Config
implementation("com.typesafe:config:1.4.0") implementation("com.typesafe:config:1.4.1")
implementation("io.github.config4k:config4k:0.4.2") implementation("io.github.config4k:config4k:0.4.2")
// to get application content root // to get application content root
implementation("net.harawata:appdirs:1.2.0") implementation("net.harawata:appdirs:1.2.1")
// dex2jar: https://github.com/DexPatcher/dex2jar/releases/tag/v2.1-20190905-lanchon // dex2jar: https://github.com/DexPatcher/dex2jar/releases/tag/v2.1-20190905-lanchon
implementation("com.github.DexPatcher.dex2jar:dex-tools:v2.1-20190905-lanchon") implementation("com.github.DexPatcher.dex2jar:dex-tools:v2.1-20190905-lanchon")

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -1,12 +1,14 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 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
import java.io.BufferedReader import java.io.BufferedReader
plugins { plugins {
// id("org.jetbrains.kotlin.jvm") version "1.4.21"
application application
id("com.github.johnrengelman.shadow") version "6.1.0" id("com.github.johnrengelman.shadow") version "7.0.0"
id("org.jmailen.kotlinter") version "3.3.0" id("org.jmailen.kotlinter") version "3.4.3"
id("edu.sc.seis.launch4j") version "2.4.9" id("edu.sc.seis.launch4j") version "2.5.0"
id("de.fuerstenau.buildconfig") version "1.1.8" id("de.fuerstenau.buildconfig") version "1.1.8"
} }
@ -14,7 +16,6 @@ val TachideskVersion = "v0.3.0"
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
maven { maven {
url = uri("https://jitpack.io") url = uri("https://jitpack.io")
} }
@ -22,7 +23,7 @@ repositories {
dependencies { dependencies {
// implementation(platform("org.jetbrains.kotlin:kotlin-bom")) // implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation(kotlin("stdlib-jdk8"))
// Source models and interfaces from Tachiyomi 1.x // Source models and interfaces from Tachiyomi 1.x
// using source class from tachiyomi commit 9493577de27c40ce8b2b6122cc447d025e34c477 to not depend on tachiyomi.sourceapi // using source class from tachiyomi commit 9493577de27c40ce8b2b6122cc447d025e34c477 to not depend on tachiyomi.sourceapi
@ -34,10 +35,10 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion") implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion") implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion") implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
implementation("com.squareup.okio:okio:2.9.0") implementation("com.squareup.okio:okio:2.10.0")
// retrofit // Retrofit
val retrofitVersion = "2.9.0" val retrofitVersion = "2.9.0"
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion") implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0") implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")
@ -45,13 +46,10 @@ dependencies {
implementation("com.squareup.retrofit2:adapter-rxjava:$retrofitVersion") implementation("com.squareup.retrofit2:adapter-rxjava:$retrofitVersion")
// reactivex // Reactivex
implementation("io.reactivex:rxjava:1.3.8") implementation("io.reactivex:rxjava:1.3.8")
// implementation("io.reactivex:rxandroid:1.2.1")
// implementation("com.jakewharton.rxrelay:rxrelay:1.2.0")
// implementation("com.github.pwittchen:reactivenetwork:0.13.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0")
implementation("com.google.code.gson:gson:2.8.6") implementation("com.google.code.gson:gson:2.8.6")
implementation("com.github.salomonbrys.kotson:kotson:2.5.0") implementation("com.github.salomonbrys.kotson:kotson:2.5.0")
@ -60,18 +58,19 @@ dependencies {
// api // api
implementation("io.javalin:javalin:3.12.0") implementation("io.javalin:javalin:3.13.6")
implementation("com.fasterxml.jackson.core:jackson-databind:2.10.3") implementation("com.fasterxml.jackson.core:jackson-databind:2.12.3")
// Exposed ORM // Exposed ORM
val exposedVersion = "0.28.1" val exposedVersion = "0.31.1"
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion") implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion") implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion") implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
implementation("com.h2database:h2:1.4.199") implementation("com.h2database:h2:1.4.200")
// tray icon // tray icon
implementation("com.dorkbox:SystemTray:3.17") implementation("com.dorkbox:SystemTray:4.1")
implementation("com.dorkbox:Utilities:1.9")
// AndroidCompat // AndroidCompat
@ -85,12 +84,9 @@ dependencies {
testImplementation(kotlin("test-junit5")) testImplementation(kotlin("test-junit5"))
} }
val name = "ir.armor.tachidesk.Main" val MainClass = "ir.armor.tachidesk.Main"
application { application {
mainClass.set(name) mainClass.set(MainClass)
// Required by ShadowJar.
mainClassName = name
} }
sourceSets { sourceSets {
@ -114,24 +110,47 @@ val TachideskRevision = Runtime
} }
buildConfig {
appName = rootProject.name
clsName = "BuildConfig"
packageName = "ir.armor.tachidesk.server"
version = TachideskVersion
buildConfigField("String", "name", rootProject.name)
buildConfigField("String", "version", TachideskVersion)
buildConfigField("String", "revision", TachideskRevision)
buildConfigField("boolean", "debug", project.hasProperty("debugApp").toString())
}
launch4j { //used for windows
mainClassName = MainClass
bundledJrePath = "jre"
bundledJre64Bit = true
jreMinVersion = "8"
outputDir = "${rootProject.name}-$TachideskVersion-$TachideskRevision-win32"
icon = "${projectDir}/src/main/resources/icon/faviconlogo.ico"
jar = "${projectDir}/build/${rootProject.name}-$TachideskVersion-$TachideskRevision.jar"
}
tasks { tasks {
jar { jar {
manifest { manifest {
attributes( attributes(
mapOf( mapOf(
"Main-Class" to "com.example.MainKt", //will make your jar (produced by jar task) runnable "Main-Class" to MainClass, //will make your jar (produced by jar task) runnable
"ImplementationTitle" to project.name, "Implementation-Title" to rootProject.name,
"Implementation-Version" to project.version) "Implementation-Version" to "$TachideskVersion-$TachideskRevision")
) )
} }
} }
shadowJar { shadowJar {
manifest.inheritFrom(jar.get().manifest) //will make your shadowJar (produced by jar task) runnable manifest.inheritFrom(jar.get().manifest) //will make your shadowJar (produced by jar task) runnable
archiveBaseName.set("Tachidesk") archiveBaseName.set(rootProject.name)
archiveVersion.set(TachideskVersion) archiveVersion.set(TachideskVersion)
archiveClassifier.set(TachideskRevision) archiveClassifier.set(TachideskRevision)
} }
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { withType<KotlinCompile> {
kotlinOptions { kotlinOptions {
freeCompilerArgs = listOf( freeCompilerArgs = listOf(
"-Xopt-in=kotlin.RequiresOptIn", "-Xopt-in=kotlin.RequiresOptIn",
@ -143,85 +162,74 @@ tasks {
test { test {
useJUnit() useJUnit()
} }
}
launch4j { //used for windows register<Zip>("windowsPackage") {
mainClassName = name from(fileTree("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32"))
bundledJrePath = "jre" destinationDirectory.set(File("$buildDir"))
bundledJre64Bit = true archiveFileName.set("${rootProject.name}-$TachideskVersion-$TachideskRevision-win32.zip")
jreMinVersion = "8" dependsOn("windowsPackageWorkaround2")
outputDir = "Tachidesk-$TachideskVersion-$TachideskRevision-win32" }
icon = "${projectDir}/src/main/resources/icon/faviconlogo.ico"
jar = "${projectDir}/build/Tachidesk-$TachideskVersion-$TachideskRevision.jar" register<Delete>("windowsPackageWorkaround2") {
} delete(
"$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/jre",
tasks.register<Zip>("windowsPackage") { "$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/lib",
from(fileTree("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32")) "$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/server.exe",
destinationDirectory.set(File("$buildDir")) "$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32"
archiveFileName.set("Tachidesk-$TachideskVersion-$TachideskRevision-win32.zip") )
dependsOn("windowsPackageWorkaround2") dependsOn("windowsPackageWorkaround")
} }
tasks.register<Delete>("windowsPackageWorkaround2") { register<Copy>("windowsPackageWorkaround") {
delete( from("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32")
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/jre", into("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32")
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/lib", dependsOn("deleteUnwantedJreDir")
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/server.exe", }
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32"
) register<Delete>("deleteUnwantedJreDir") {
dependsOn("windowsPackageWorkaround") delete(
} "$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/jdk8u282-b08-jre"
)
tasks.register<Copy>("windowsPackageWorkaround") { dependsOn("addJreToDistributable")
from("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32") }
into("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32")
dependsOn("deleteUnwantedJreDir") register<Copy>("addJreToDistributable") {
} from(zipTree("$buildDir/OpenJDK8U-jre_x86-32_windows_hotspot_8u282b08.zip"))
into("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32")
tasks.register<Delete>("deleteUnwantedJreDir") { eachFile {
delete( path = path.replace(".*-jre".toRegex(),"jre")
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/jdk8u282-b08-jre" }
) dependsOn("downloadJre")
dependsOn("addJreToDistributable") dependsOn("createExe")
} }
tasks.register<Copy>("addJreToDistributable") { register<de.undercouch.gradle.tasks.download.Download>("downloadJre") {
from(zipTree("$buildDir/OpenJDK8U-jre_x86-32_windows_hotspot_8u282b08.zip")) src("https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u282-b08/OpenJDK8U-jre_x86-32_windows_hotspot_8u282b08.zip")
into("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32") dest(buildDir)
eachFile { overwrite(false)
path = path.replace(".*-jre".toRegex(),"jre") onlyIfModified(true)
}
withType<ShadowJar> {
destinationDirectory.set(File("$rootDir/server/build"))
dependsOn("formatKotlin", "lintKotlin")
}
named("run") {
dependsOn("formatKotlin", "lintKotlin")
}
named<Copy>("processResources") {
duplicatesStrategy = DuplicatesStrategy.WARN
mustRunAfter(":webUI:copyBuild")
}
withType<LintTask> {
source(files("src"))
}
withType<FormatTask> {
source(files("src"))
} }
dependsOn("downloadJre")
dependsOn("createExe")
} }
tasks.register<de.undercouch.gradle.tasks.download.Download>("downloadJre") {
src("https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u282-b08/OpenJDK8U-jre_x86-32_windows_hotspot_8u282b08.zip")
dest(buildDir)
overwrite(false)
onlyIfModified(true)
}
tasks.withType<ShadowJar> {
destinationDirectory.set(File("$rootDir/server/build"))
dependsOn("formatKotlin", "lintKotlin")
}
tasks.named("run") {
dependsOn("formatKotlin", "lintKotlin")
}
tasks.named("processResources") {
mustRunAfter(":webUI:copyBuild")
}
buildConfig {
version = TachideskVersion
buildConfigField("String", "version", TachideskVersion)
buildConfigField("String", "revision", TachideskRevision)
clsName = "BuildConfig"
packageName = "ir.armor.tachidesk.server"
buildConfigField("boolean", "DEBUG", project.hasProperty("debugApp").toString())
}

View File

@ -9,8 +9,8 @@ import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import ir.armor.tachidesk.impl.Category.createCategory import ir.armor.tachidesk.impl.Category.createCategory
import ir.armor.tachidesk.impl.Category.getCategoryList import ir.armor.tachidesk.impl.Category.getCategoryList
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupRestoreValidator.ValidationResult import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupValidator.ValidationResult
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupRestoreValidator.validate import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupValidator.validate
import ir.armor.tachidesk.impl.backup.legacy.models.Backup import ir.armor.tachidesk.impl.backup.legacy.models.Backup
import ir.armor.tachidesk.impl.backup.legacy.models.DHistory import ir.armor.tachidesk.impl.backup.legacy.models.DHistory
import ir.armor.tachidesk.impl.backup.models.CategoryImpl import ir.armor.tachidesk.impl.backup.models.CategoryImpl
@ -54,7 +54,7 @@ object LegacyBackupImport : LegacyBackupBase() {
json.get(Backup.CATEGORIES)?.let { restoreCategories(it) } json.get(Backup.CATEGORIES)?.let { restoreCategories(it) }
// Store source mapping for error messages // Store source mapping for error messages
sourceMapping = LegacyBackupRestoreValidator.getSourceMapping(json) sourceMapping = LegacyBackupValidator.getSourceMapping(json)
// Restore individual manga // Restore individual manga
mangasJson.forEach { mangasJson.forEach {

View File

@ -13,7 +13,7 @@ import ir.armor.tachidesk.model.database.SourceTable
import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
object LegacyBackupRestoreValidator { object LegacyBackupValidator {
data class ValidationResult(val missingSources: List<String>, val missingTrackers: List<String>) data class ValidationResult(val missingSources: List<String>, val missingTrackers: List<String>)
/** /**

View File

@ -13,9 +13,9 @@ import dorkbox.systemTray.SystemTray.TrayType
import dorkbox.util.CacheUtil import dorkbox.util.CacheUtil
import dorkbox.util.Desktop import dorkbox.util.Desktop
import ir.armor.tachidesk.Main import ir.armor.tachidesk.Main
import ir.armor.tachidesk.server.BuildConfig
import ir.armor.tachidesk.server.serverConfig import ir.armor.tachidesk.server.serverConfig
import java.awt.event.ActionListener import kotlin.system.exitProcess
import java.io.IOException
fun openInBrowser() { fun openInBrowser() {
try { try {
@ -32,22 +32,17 @@ fun systemTray(): SystemTray? {
if (System.getProperty("os.name").startsWith("Windows")) if (System.getProperty("os.name").startsWith("Windows"))
SystemTray.FORCE_TRAY_TYPE = TrayType.Swing SystemTray.FORCE_TRAY_TYPE = TrayType.Swing
CacheUtil.clear() CacheUtil.clear(BuildConfig.name)
val systemTray = SystemTray.get() ?: return null val systemTray = SystemTray.get(BuildConfig.name) ?: return null
val mainMenu = systemTray.menu val mainMenu = systemTray.menu
mainMenu.add( mainMenu.add(
MenuItem( MenuItem(
"Open Tachidesk", "Open Tachidesk"
ActionListener { ) {
try { openInBrowser()
Desktop.browseURL("http://127.0.0.1:4567") }
} catch (e: IOException) {
e.printStackTrace()
}
}
)
) )
val icon = Main::class.java.getResource("/icon/faviconlogo.png") val icon = Main::class.java.getResource("/icon/faviconlogo.png")
@ -56,13 +51,15 @@ fun systemTray(): SystemTray? {
systemTray.setImage(icon) systemTray.setImage(icon)
// systemTray.status = "No Mail" // systemTray.status = "No Mail"
systemTray.getMenu().add( mainMenu.add(
MenuItem("Quit") { MenuItem("Quit") {
systemTray.shutdown() systemTray.shutdown()
System.exit(0) exitProcess(0)
} }
) )
systemTray.installShutdownHook()
return systemTray return systemTray
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()