Paper/patches/server/0720-Add-git-branch-and-commit-to-manifest.patch
Prof-Bloodstone d50cc01b08
Make gradle take build number from env vars and add git build info (#5890)
* Make gradle take build number from env vars

* Add git information to manifest and version command/log

* trim

* Fix tests by adding NotNull annotations

* rebase

* Apply suggestions from kashike

Co-authored-by: Riley Park <riley.park@meino.net>

* Not always show branch

* Why can't everything be NotNull by default?

* Rebase

Co-authored-by: Riley Park <riley.park@meino.net>
2021-06-23 17:19:44 +00:00

28 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Professor Bloodstone <git@bloodstone.dev>
Date: Sun, 20 Jun 2021 01:14:41 +0200
Subject: [PATCH] Add git branch and commit to manifest
diff --git a/build.gradle.kts b/build.gradle.kts
index e4d1fe13d541fb0e7eee81607d9651cdf7032cb0..39beb0331282b297f4f3857560d24ce6a616210d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -78,6 +78,7 @@ tasks.jar {
val git = Git(rootProject.layout.projectDirectory.path)
val gitHash = git("rev-parse", "HEAD").getText().substring(0, 7)
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
+ val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -87,6 +88,8 @@ tasks.jar {
"Specification-Version" to project.version,
"Specification-Vendor" to "Bukkit Team",
"Multi-Release" to "true", // Paper
+ "Git-Branch" to gitBranch, // Paper
+ "Git-Commit" to gitHash, // Paper
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)