1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-11-23 15:21:06 +01:00
lighteco/build.gradle.kts

80 lines
1.9 KiB
Text
Raw Normal View History

2023-07-30 16:00:37 +02:00
import java.io.ByteArrayOutputStream
plugins {
id("java")
2023-08-29 09:13:25 +02:00
id("org.sonarqube") version "4.2.1.3168"
2024-07-16 18:22:32 +02:00
id("com.diffplug.spotless") version "6.25.0"
2023-07-30 16:00:37 +02:00
}
2023-07-30 17:04:46 +02:00
val majorVersion = 0
val minorVersion = 1
val patchVersion = determinePatchVersion(project)
val commitHash = determineCommitHash(project)
2023-07-30 16:00:37 +02:00
2024-07-16 18:22:32 +02:00
defaultTasks("spotlessApply")
repositories {
mavenCentral()
}
2023-07-30 16:00:37 +02:00
allprojects {
group = "dev.xhyrom"
2023-07-30 17:04:46 +02:00
version = "$majorVersion.$minorVersion.$patchVersion"
description = "Incredibly fast, lightweight, and modular plugin that excels across multiple platforms."
2023-07-30 17:04:46 +02:00
ext {
set("version", "$majorVersion.$minorVersion.$patchVersion+$commitHash")
set("description", description)
2023-07-30 17:04:46 +02:00
}
2023-07-30 16:00:37 +02:00
}
subprojects {
apply(plugin = "java")
apply(plugin = "java-library")
repositories {
mavenCentral()
2023-08-26 10:44:38 +02:00
maven("https://storehouse.okaeri.eu/repository/maven-public/")
maven("https://libraries.minecraft.net")
2023-07-30 16:00:37 +02:00
}
}
2024-07-16 18:22:32 +02:00
spotless {
java {
importOrder()
removeUnusedImports()
palantirJavaFormat().style("AOSP")
formatAnnotations()
target("api/src/main/java/**", "common/src/main/java/**", "currency-money/src/main/java/**", "paper/src/main/java/**", "sponge-8/src/main/java/**", "test/**/src/main/java/**")
}
}
2023-07-30 16:00:37 +02:00
fun determinePatchVersion(project: Project): Int {
val tagInfo = ByteArrayOutputStream()
2023-07-30 17:04:46 +02:00
return try {
exec {
commandLine("git", "describe", "--tags")
standardOutput = tagInfo
}
val result = tagInfo.toString()
if (result.contains("-")) result.split("-")[1].toInt() else 0
} catch (e: Exception) {
0
2023-07-30 16:00:37 +02:00
}
2023-07-30 17:04:46 +02:00
}
2023-07-30 16:00:37 +02:00
2023-07-30 17:04:46 +02:00
fun determineCommitHash(project: Project): String {
val commitHashInfo = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = commitHashInfo
}
2023-07-30 16:00:37 +02:00
2023-10-30 12:15:15 +01:00
return commitHashInfo.toString().strip()
2023-07-30 16:00:37 +02:00
}