mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 01:44:34 -05:00
clean up build.gradle files, move constants to buildSrc
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
// Config API, moved to the global build.gradle
|
|
||||||
// implementation("com.typesafe:config:1.4.0")
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
val kotlinVersion = "1.5.21"
|
|
||||||
|
|
||||||
kotlin("jvm") version kotlinVersion
|
kotlin("jvm") version kotlinVersion
|
||||||
kotlin("plugin.serialization") version kotlinVersion
|
kotlin("plugin.serialization") version kotlinVersion
|
||||||
}
|
}
|
||||||
|
|||||||
11
buildSrc/build.gradle.kts
Normal file
11
buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("net.lingala.zip4j:zip4j:2.9.0")
|
||||||
|
}
|
||||||
33
buildSrc/src/main/kotlin/Constants.kt
Normal file
33
buildSrc/src/main/kotlin/Constants.kt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import java.io.BufferedReader
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
const val kotlinVersion = "1.5.21"
|
||||||
|
|
||||||
|
const val MainClass = "suwayomi.tachidesk.MainKt"
|
||||||
|
|
||||||
|
// should be bumped with each stable release
|
||||||
|
val tachideskVersion = System.getenv("ProductVersion") ?: "v0.4.5"
|
||||||
|
|
||||||
|
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r24"
|
||||||
|
|
||||||
|
// counts commit count on master
|
||||||
|
val tachideskRevision = runCatching {
|
||||||
|
System.getenv("ProductRevision") ?: Runtime
|
||||||
|
.getRuntime()
|
||||||
|
.exec("git rev-list HEAD --count")
|
||||||
|
.let { process ->
|
||||||
|
process.waitFor()
|
||||||
|
val output = process.inputStream.use {
|
||||||
|
it.bufferedReader().use(BufferedReader::readText)
|
||||||
|
}
|
||||||
|
process.destroy()
|
||||||
|
"r" + output.trim()
|
||||||
|
}
|
||||||
|
}.getOrDefault("r0")
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
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.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
import org.jmailen.gradle.kotlinter.tasks.FormatTask
|
||||||
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
import org.jmailen.gradle.kotlinter.tasks.LintTask
|
||||||
import java.io.BufferedReader
|
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@@ -12,15 +12,6 @@ plugins {
|
|||||||
id("com.github.gmazzo.buildconfig") version "3.0.2"
|
id("com.github.gmazzo.buildconfig") version "3.0.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("net.lingala.zip4j:zip4j:2.9.0")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://repo1.maven.org/maven2/")
|
url = uri("https://repo1.maven.org/maven2/")
|
||||||
@@ -89,11 +80,10 @@ dependencies {
|
|||||||
// implementation(fileTree("lib/"))
|
// implementation(fileTree("lib/"))
|
||||||
}
|
}
|
||||||
|
|
||||||
val MainClass = "suwayomi.tachidesk.MainKt"
|
|
||||||
application {
|
application {
|
||||||
mainClass.set(MainClass)
|
mainClass.set(MainClass)
|
||||||
|
|
||||||
// for testing electron
|
// uncomment for testing electron
|
||||||
// applicationDefaultJvmArgs = listOf(
|
// applicationDefaultJvmArgs = listOf(
|
||||||
// "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron",
|
// "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron",
|
||||||
// "-Dsuwayomi.tachidesk.config.server.electronPath=/usr/bin/electron"
|
// "-Dsuwayomi.tachidesk.config.server.electronPath=/usr/bin/electron"
|
||||||
@@ -108,32 +98,12 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// should be bumped with each stable release
|
|
||||||
val tachideskVersion = System.getenv("ProductVersion") ?: "v0.4.5"
|
|
||||||
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r24"
|
|
||||||
|
|
||||||
// counts commit count on master
|
|
||||||
val tachideskRevision = runCatching {
|
|
||||||
System.getenv("ProductRevision") ?: Runtime
|
|
||||||
.getRuntime()
|
|
||||||
.exec("git rev-list HEAD --count")
|
|
||||||
.let { process ->
|
|
||||||
process.waitFor()
|
|
||||||
val output = process.inputStream.use {
|
|
||||||
it.bufferedReader().use(BufferedReader::readText)
|
|
||||||
}
|
|
||||||
process.destroy()
|
|
||||||
"r" + output.trim()
|
|
||||||
}
|
|
||||||
}.getOrDefault("r0")
|
|
||||||
|
|
||||||
buildConfig {
|
buildConfig {
|
||||||
className("BuildConfig")
|
className("BuildConfig")
|
||||||
packageName("suwayomi.tachidesk.server")
|
packageName("suwayomi.tachidesk.server")
|
||||||
|
|
||||||
useKotlinOutput()
|
useKotlinOutput()
|
||||||
|
|
||||||
|
|
||||||
fun quoteWrap(obj: Any): String = """"$obj""""
|
fun quoteWrap(obj: Any): String = """"$obj""""
|
||||||
|
|
||||||
buildConfigField("String", "NAME", quoteWrap(rootProject.name))
|
buildConfigField("String", "NAME", quoteWrap(rootProject.name))
|
||||||
|
|||||||
Reference in New Issue
Block a user