aboutsummaryrefslogtreecommitdiff
path: root/publish/build.gradle
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-07-13 15:20:11 +0200
committermakamys <makamys@outlook.com>2022-07-13 15:20:11 +0200
commit2f9da90753a299bd0966efa0cb6f8a12e7a4e37a (patch)
treee470558ce6744e7613b80e3f304165f605460d09 /publish/build.gradle
parent722b63430a4b9bf4257aec5ac1876228f434e15b (diff)
downloadNeodymium-2f9da90753a299bd0966efa0cb6f8a12e7a4e37a.tar.gz
Neodymium-2f9da90753a299bd0966efa0cb6f8a12e7a4e37a.tar.bz2
Neodymium-2f9da90753a299bd0966efa0cb6f8a12e7a4e37a.zip
buildscript: Compute version from git tag if version.txt is absent
Diffstat (limited to 'publish/build.gradle')
-rw-r--r--publish/build.gradle20
1 files changed, 19 insertions, 1 deletions
diff --git a/publish/build.gradle b/publish/build.gradle
index 16bc7fc..9cf7c6e 100644
--- a/publish/build.gradle
+++ b/publish/build.gradle
@@ -9,7 +9,25 @@ import groovy.json.JsonSlurper
import okhttp3.OkHttpClient
import java.util.concurrent.TimeUnit
-def buildVersion = new File("${projectDir}/version.txt").getText('UTF-8').trim()
+def getCommitVersion(){
+ try {
+ def commitHashProc = "python3 ${projectDir}/get_version.py".execute()
+ commitHashProc.waitFor()
+ if(commitHashProc.exitValue() == 0){
+ def commitHash = commitHashProc.text.trim()
+
+ return commitHash
+ } else {
+ println commitHashProc.err.text
+ throw new Exception("get_version.py exited with non-zero return value")
+ }
+ } catch(Exception e){
+ println "Failed to run get_version.py: " + e.getMessage()
+ }
+ return "UNKNOWN" // fallback
+}
+
+def buildVersion = getCommitVersion()
def changeLog = new File("${projectDir}/changelog.md").getText('UTF-8')
def gameVersionsMap = new JsonSlurper().parseText(file("gameVersions.json").getText('UTF-8'))
ext.gameVersions = gameVersionsMap.keySet()