aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-22 22:44:32 +0200
committermakamys <makamys@outlook.com>2022-06-22 22:44:32 +0200
commit36f202c3e3863f19644cbe7044c921c9f541d575 (patch)
tree3bdeb82a734ca136122511caaa3fe9a12e256a9a
parent0b2d306a9b05320a2194a5a9d1058d9bf34b1217 (diff)
downloadNeodymium-36f202c3e3863f19644cbe7044c921c9f541d575.tar.gz
Neodymium-36f202c3e3863f19644cbe7044c921c9f541d575.tar.bz2
Neodymium-36f202c3e3863f19644cbe7044c921c9f541d575.zip
Put commit hash in MANIFEST.MF
-rw-r--r--project.gradle22
1 files changed, 21 insertions, 1 deletions
diff --git a/project.gradle b/project.gradle
index ed0b64a..8edceeb 100644
--- a/project.gradle
+++ b/project.gradle
@@ -1,7 +1,27 @@
+def getCommitHash(){
+ try {
+ def commitHashProc = "git describe --always --dirty".execute()
+ commitHashProc.waitFor()
+ if(commitHashProc.exitValue() == 0){
+ def commitHash = commitHashProc.text.trim()
+
+ return commitHash
+ } else {
+ println commitHashProc.err.text
+ throw new Exception("git describe exited with non-zero return value")
+ }
+ } catch(Exception e){
+ println "Failed to get commit version: " + e.getMessage()
+ }
+ return "UNKNOWN" // fallback
+}
+
+
jar {
manifest {
attributes (
- 'FMLAT': "LODMod_at.cfg"
+ 'FMLAT': "LODMod_at.cfg",
+ 'Commit-ID': getCommitHash(),
)
}
}