Don't crash the build if git is not available

This commit is contained in:
ZacSharp 2023-10-15 20:51:17 +02:00
parent 20d62c68bf
commit 9accb2bfb0
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
1 changed files with 7 additions and 2 deletions

View File

@ -21,13 +21,18 @@ allprojects {
apply plugin: "maven-publish"
archivesBaseName = rootProject.archives_base_name
def vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim()
def vers = ""
try {
vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim()
} catch (Exception e) {
println "Version detection failed: " + e
}
if (!vers.startsWith("v")) {
println "git doesn't appear to be installed!"
println "using version number: " + rootProject.mod_version
version = rootProject.mod_version
} else {
version = vers.substring(1)
println "Detected version " + version
}
group = rootProject.maven_group