diff options
author | makamys <makamys@outlook.com> | 2022-06-23 03:58:59 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-23 04:00:09 +0200 |
commit | acf53c04e35fb2ec914bb7d9279dca4c9173fb9c (patch) | |
tree | 5b27e8f68feca29f7f45d5eb547ca11059e476a2 /buildscript | |
parent | 9ef4af7127d97e5467c101f4566544cf027e72a7 (diff) | |
download | Neodymium-acf53c04e35fb2ec914bb7d9279dca4c9173fb9c.tar.gz Neodymium-acf53c04e35fb2ec914bb7d9279dca4c9173fb9c.tar.bz2 Neodymium-acf53c04e35fb2ec914bb7d9279dca4c9173fb9c.zip |
Update buildscript
(Reimplements the MANIFEST.MF thing)
Diffstat (limited to 'buildscript')
-rw-r--r-- | buildscript/forge-1.7.gradle | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/buildscript/forge-1.7.gradle b/buildscript/forge-1.7.gradle index ca2f66b..67fd4c7 100644 --- a/buildscript/forge-1.7.gradle +++ b/buildscript/forge-1.7.gradle @@ -87,4 +87,33 @@ task devJar(type: Jar) { artifacts { archives sourcesJar archives devJar -}
\ No newline at end of file +} + +// Add git commit hash to MANIFEST.MF + +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 ( + 'Commit-ID': getCommitHash(), + ) + } +} |