mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Use different version format for snapshots
This commit is contained in:
@@ -30,6 +30,14 @@ import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.fullVersion(): String {
|
||||
var version = version.toString()
|
||||
if (version.endsWith("-SNAPSHOT")) {
|
||||
version += " (b${buildNumberAsString()}-${lastCommitHash()}}"
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
fun Project.lastCommitHash(): String? =
|
||||
the<IndraGitExtension>().commit()?.name?.substring(0, 7)
|
||||
|
||||
@@ -40,6 +48,9 @@ fun Project.branchName(): String =
|
||||
fun Project.buildNumber(): Int =
|
||||
Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1"))
|
||||
|
||||
fun Project.buildNumberAsString(): String =
|
||||
buildNumber().takeIf { it != -1 }?.toString() ?: "??"
|
||||
|
||||
fun Project.relocate(pattern: String) {
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate(pattern, "org.geysermc.floodgate.shaded.$pattern")
|
||||
|
||||
@@ -2,6 +2,7 @@ plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
// id("net.ltgt.errorprone")
|
||||
id("net.kyori.indra.git")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -14,7 +15,7 @@ tasks {
|
||||
expand(
|
||||
"id" to "floodgate",
|
||||
"name" to "floodgate",
|
||||
"version" to project.version,
|
||||
"version" to fullVersion(),
|
||||
"description" to project.description,
|
||||
"url" to "https://geysermc.org",
|
||||
"author" to "GeyserMC"
|
||||
|
||||
Reference in New Issue
Block a user