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.named
|
||||||
import org.gradle.kotlin.dsl.the
|
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? =
|
fun Project.lastCommitHash(): String? =
|
||||||
the<IndraGitExtension>().commit()?.name?.substring(0, 7)
|
the<IndraGitExtension>().commit()?.name?.substring(0, 7)
|
||||||
|
|
||||||
@@ -40,6 +48,9 @@ fun Project.branchName(): String =
|
|||||||
fun Project.buildNumber(): Int =
|
fun Project.buildNumber(): Int =
|
||||||
Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1"))
|
Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1"))
|
||||||
|
|
||||||
|
fun Project.buildNumberAsString(): String =
|
||||||
|
buildNumber().takeIf { it != -1 }?.toString() ?: "??"
|
||||||
|
|
||||||
fun Project.relocate(pattern: String) {
|
fun Project.relocate(pattern: String) {
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
relocate(pattern, "org.geysermc.floodgate.shaded.$pattern")
|
relocate(pattern, "org.geysermc.floodgate.shaded.$pattern")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ plugins {
|
|||||||
`java-library`
|
`java-library`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
// id("net.ltgt.errorprone")
|
// id("net.ltgt.errorprone")
|
||||||
|
id("net.kyori.indra.git")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -14,7 +15,7 @@ tasks {
|
|||||||
expand(
|
expand(
|
||||||
"id" to "floodgate",
|
"id" to "floodgate",
|
||||||
"name" to "floodgate",
|
"name" to "floodgate",
|
||||||
"version" to project.version,
|
"version" to fullVersion(),
|
||||||
"description" to project.description,
|
"description" to project.description,
|
||||||
"url" to "https://geysermc.org",
|
"url" to "https://geysermc.org",
|
||||||
"author" to "GeyserMC"
|
"author" to "GeyserMC"
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
id("net.kyori.blossom") version "1.2.0"
|
id("net.kyori.blossom") version "1.2.0"
|
||||||
id("net.kyori.indra")
|
|
||||||
id("net.kyori.indra.git")
|
|
||||||
}
|
}
|
||||||
includeBuild("build-logic")
|
includeBuild("build-logic")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user