Get short commit ref using a more proper method

This commit is contained in:
Kyle Wood 2021-06-26 22:15:13 -05:00
parent 12dec20e11
commit e33ed8939f
No known key found for this signature in database
GPG Key ID: 86AF5613ACA30CC5
2 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..3e05459f27c4c5697ae65da504d67a6a
/.project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..9b738b8561f75a2531d64abb36f4cd9d9561cbfc
index 0000000000000000000000000000000000000000..6e5431276a68204ab7aee451b2074afc371068b5
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,135 @@
@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..9b738b8561f75a2531d64abb36f4cd9d
+
+ manifest {
+ val git = Git(rootProject.layout.projectDirectory.path)
+ val gitHash = git("rev-parse", "HEAD").getText().substring(0, 7)
+ val gitHash = git("rev-parse", "--short=7", "HEAD").getText()
+ val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
+ attributes(
+ "Main-Class" to "org.bukkit.craftbukkit.Main",

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Add git branch and commit to manifest
diff --git a/build.gradle.kts b/build.gradle.kts
index e4d1fe13d541fb0e7eee81607d9651cdf7032cb0..39beb0331282b297f4f3857560d24ce6a616210d 100644
index 2172b842ecd76a34d19fcaa54e087cc5b9ab8d7f..ff58e15e559c48d0dcf049e1b7708b71c0b789b6 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 gitHash = git("rev-parse", "--short=7", "HEAD").getText()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
+ val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(