Skip to content

Commit

Permalink
clean up build.gradle files, move constants to buildSrc
Browse files Browse the repository at this point in the history
  • Loading branch information
AriaMoradi committed Aug 17, 2021
1 parent 8a9a4f2 commit 291c2e6
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 38 deletions.
4 changes: 0 additions & 4 deletions AndroidCompat/Config/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
dependencies {
// Config API, moved to the global build.gradle
// implementation("com.typesafe:config:1.4.0")
}
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
val kotlinVersion = "1.5.21"

kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
}
Expand Down
11 changes: 11 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

dependencies {
implementation("net.lingala.zip4j:zip4j:2.9.0")
}
33 changes: 33 additions & 0 deletions buildSrc/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
@@ -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")

34 changes: 2 additions & 32 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

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.time.Instant

plugins {
Expand All @@ -12,15 +12,6 @@ plugins {
id("com.github.gmazzo.buildconfig") version "3.0.2"
}

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("net.lingala.zip4j:zip4j:2.9.0")
}
}

repositories {
maven {
url = uri("https://repo1.maven.org/maven2/")
Expand Down Expand Up @@ -89,11 +80,10 @@ dependencies {
// implementation(fileTree("lib/"))
}

val MainClass = "suwayomi.tachidesk.MainKt"
application {
mainClass.set(MainClass)

// for testing electron
// uncomment for testing electron
// applicationDefaultJvmArgs = listOf(
// "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron",
// "-Dsuwayomi.tachidesk.config.server.electronPath=/usr/bin/electron"
Expand All @@ -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 {
className("BuildConfig")
packageName("suwayomi.tachidesk.server")

useKotlinOutput()


fun quoteWrap(obj: Any): String = """"$obj""""

buildConfigField("String", "NAME", quoteWrap(rootProject.name))
Expand Down

0 comments on commit 291c2e6

Please sign in to comment.