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 {
mavenCentral()
jcenter()
maven {
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 {
id("org.jetbrains.kotlin.jvm") version "1.4.21" apply false // Also in buildSrc Config.kt
id("java")
kotlin("jvm") version "1.4.32"
}
allprojects {
@ -11,7 +10,6 @@ allprojects {
version = "1.0"
repositories {
jcenter()
mavenCentral()
maven("https://maven.google.com/")
maven("https://jitpack.io")
@ -28,7 +26,6 @@ val projects = listOf(
)
configure(projects) {
apply(plugin = "java")
apply(plugin = "org.jetbrains.kotlin.jvm")
java {
@ -36,33 +33,32 @@ configure(projects) {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
// Kotlin
implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION))
implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION))
implementation(kotlin("reflect", version = "1.4.21"))
testImplementation(kotlin("test", version = "1.4.21"))
implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))
testImplementation(kotlin("test"))
// 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-jdk8:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
// 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
implementation("org.slf4j:slf4j-api:1.7.30")
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
implementation("io.reactivex:rxjava:1.3.8")
@ -73,11 +69,11 @@ configure(projects) {
// 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")
// 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
implementation("com.github.DexPatcher.dex2jar:dex-tools:v2.1-20190905-lanchon")

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

View File

@ -1,12 +1,14 @@
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
plugins {
// id("org.jetbrains.kotlin.jvm") version "1.4.21"
application
id("com.github.johnrengelman.shadow") version "6.1.0"
id("org.jmailen.kotlinter") version "3.3.0"
id("edu.sc.seis.launch4j") version "2.4.9"
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"
id("de.fuerstenau.buildconfig") version "1.1.8"
}
@ -14,7 +16,6 @@ val TachideskVersion = "v0.3.0"
repositories {
mavenCentral()
jcenter()
maven {
url = uri("https://jitpack.io")
}
@ -22,7 +23,7 @@ repositories {
dependencies {
// 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
// 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:logging-interceptor:$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"
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")
@ -45,13 +46,10 @@ dependencies {
implementation("com.squareup.retrofit2:adapter-rxjava:$retrofitVersion")
// reactivex
// Reactivex
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.github.salomonbrys.kotson:kotson:2.5.0")
@ -60,18 +58,19 @@ dependencies {
// api
implementation("io.javalin:javalin:3.12.0")
implementation("com.fasterxml.jackson.core:jackson-databind:2.10.3")
implementation("io.javalin:javalin:3.13.6")
implementation("com.fasterxml.jackson.core:jackson-databind:2.12.3")
// Exposed ORM
val exposedVersion = "0.28.1"
val exposedVersion = "0.31.1"
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
implementation("com.h2database:h2:1.4.199")
implementation("com.h2database:h2:1.4.200")
// tray icon
implementation("com.dorkbox:SystemTray:3.17")
implementation("com.dorkbox:SystemTray:4.1")
implementation("com.dorkbox:Utilities:1.9")
// AndroidCompat
@ -85,12 +84,9 @@ dependencies {
testImplementation(kotlin("test-junit5"))
}
val name = "ir.armor.tachidesk.Main"
val MainClass = "ir.armor.tachidesk.Main"
application {
mainClass.set(name)
// Required by ShadowJar.
mainClassName = name
mainClass.set(MainClass)
}
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 {
jar {
manifest {
attributes(
mapOf(
"Main-Class" to "com.example.MainKt", //will make your jar (produced by jar task) runnable
"ImplementationTitle" to project.name,
"Implementation-Version" to project.version)
"Main-Class" to MainClass, //will make your jar (produced by jar task) runnable
"Implementation-Title" to rootProject.name,
"Implementation-Version" to "$TachideskVersion-$TachideskRevision")
)
}
}
shadowJar {
manifest.inheritFrom(jar.get().manifest) //will make your shadowJar (produced by jar task) runnable
archiveBaseName.set("Tachidesk")
archiveBaseName.set(rootProject.name)
archiveVersion.set(TachideskVersion)
archiveClassifier.set(TachideskRevision)
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xopt-in=kotlin.RequiresOptIn",
@ -143,85 +162,74 @@ tasks {
test {
useJUnit()
}
}
launch4j { //used for windows
mainClassName = name
bundledJrePath = "jre"
bundledJre64Bit = true
jreMinVersion = "8"
outputDir = "Tachidesk-$TachideskVersion-$TachideskRevision-win32"
icon = "${projectDir}/src/main/resources/icon/faviconlogo.ico"
jar = "${projectDir}/build/Tachidesk-$TachideskVersion-$TachideskRevision.jar"
}
tasks.register<Zip>("windowsPackage") {
from(fileTree("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32"))
destinationDirectory.set(File("$buildDir"))
archiveFileName.set("Tachidesk-$TachideskVersion-$TachideskRevision-win32.zip")
dependsOn("windowsPackageWorkaround2")
}
tasks.register<Delete>("windowsPackageWorkaround2") {
delete(
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/jre",
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/lib",
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/server.exe",
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32"
)
dependsOn("windowsPackageWorkaround")
}
tasks.register<Copy>("windowsPackageWorkaround") {
from("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32")
into("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32")
dependsOn("deleteUnwantedJreDir")
}
tasks.register<Delete>("deleteUnwantedJreDir") {
delete(
"$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32/jdk8u282-b08-jre"
)
dependsOn("addJreToDistributable")
}
tasks.register<Copy>("addJreToDistributable") {
from(zipTree("$buildDir/OpenJDK8U-jre_x86-32_windows_hotspot_8u282b08.zip"))
into("$buildDir/Tachidesk-$TachideskVersion-$TachideskRevision-win32")
eachFile {
path = path.replace(".*-jre".toRegex(),"jre")
register<Zip>("windowsPackage") {
from(fileTree("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32"))
destinationDirectory.set(File("$buildDir"))
archiveFileName.set("${rootProject.name}-$TachideskVersion-$TachideskRevision-win32.zip")
dependsOn("windowsPackageWorkaround2")
}
register<Delete>("windowsPackageWorkaround2") {
delete(
"$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/jre",
"$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/lib",
"$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/server.exe",
"$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32/Tachidesk-$TachideskVersion-$TachideskRevision-win32"
)
dependsOn("windowsPackageWorkaround")
}
register<Copy>("windowsPackageWorkaround") {
from("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32")
into("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32")
dependsOn("deleteUnwantedJreDir")
}
register<Delete>("deleteUnwantedJreDir") {
delete(
"$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32/jdk8u282-b08-jre"
)
dependsOn("addJreToDistributable")
}
register<Copy>("addJreToDistributable") {
from(zipTree("$buildDir/OpenJDK8U-jre_x86-32_windows_hotspot_8u282b08.zip"))
into("$buildDir/${rootProject.name}-$TachideskVersion-$TachideskRevision-win32")
eachFile {
path = path.replace(".*-jre".toRegex(),"jre")
}
dependsOn("downloadJre")
dependsOn("createExe")
}
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)
}
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 ir.armor.tachidesk.impl.Category.createCategory
import ir.armor.tachidesk.impl.Category.getCategoryList
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupRestoreValidator.ValidationResult
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupRestoreValidator.validate
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupValidator.ValidationResult
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.DHistory
import ir.armor.tachidesk.impl.backup.models.CategoryImpl
@ -54,7 +54,7 @@ object LegacyBackupImport : LegacyBackupBase() {
json.get(Backup.CATEGORIES)?.let { restoreCategories(it) }
// Store source mapping for error messages
sourceMapping = LegacyBackupRestoreValidator.getSourceMapping(json)
sourceMapping = LegacyBackupValidator.getSourceMapping(json)
// Restore individual manga
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.transactions.transaction
object LegacyBackupRestoreValidator {
object LegacyBackupValidator {
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.Desktop
import ir.armor.tachidesk.Main
import ir.armor.tachidesk.server.BuildConfig
import ir.armor.tachidesk.server.serverConfig
import java.awt.event.ActionListener
import java.io.IOException
import kotlin.system.exitProcess
fun openInBrowser() {
try {
@ -32,22 +32,17 @@ fun systemTray(): SystemTray? {
if (System.getProperty("os.name").startsWith("Windows"))
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
mainMenu.add(
MenuItem(
"Open Tachidesk",
ActionListener {
try {
Desktop.browseURL("http://127.0.0.1:4567")
} catch (e: IOException) {
e.printStackTrace()
}
}
)
"Open Tachidesk"
) {
openInBrowser()
}
)
val icon = Main::class.java.getResource("/icon/faviconlogo.png")
@ -56,13 +51,15 @@ fun systemTray(): SystemTray? {
systemTray.setImage(icon)
// systemTray.status = "No Mail"
systemTray.getMenu().add(
mainMenu.add(
MenuItem("Quit") {
systemTray.shutdown()
System.exit(0)
exitProcess(0)
}
)
systemTray.installShutdownHook()
return systemTray
} catch (e: Exception) {
e.printStackTrace()