Expose server build information

Co-authored-by: Zach Brown <1254957+zachbr@users.noreply.github.com>
Co-authored-by: Kyle Wood <kyle@denwav.dev>
Co-authored-by: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
This commit is contained in:
Zach Brown
2016-03-01 14:32:43 -06:00
parent 560b13ca08
commit f41436f787
13 changed files with 581 additions and 100 deletions

View File

@@ -1,4 +1,5 @@
import io.papermc.paperweight.util.*
import java.time.Instant
plugins {
java
@@ -80,18 +81,24 @@ tasks.jar {
manifest {
val git = Git(rootProject.layout.projectDirectory.path)
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
val build = System.getenv("BUILD_NUMBER") ?: null
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
"Implementation-Version" to "git-Paper-$implementationVersion",
"Implementation-Title" to "Paper",
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Title" to "Paper",
"Specification-Version" to project.version,
"Specification-Vendor" to "Bukkit Team",
"Specification-Vendor" to "Paper Team",
"Brand-Id" to "papermc:paper",
"Brand-Name" to "Paper",
"Build-Number" to (build ?: ""),
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
"Git-Commit" to gitHash, // Paper
"CraftBukkit-Package-Version" to paperweight.craftBukkitPackageVersion.get(), // Paper