Build: fix build failure if not building from git repo
This commit is contained in:
parent
b7c2050487
commit
a37f38a412
@ -26,14 +26,29 @@ import org.ajoberstar.grgit.*
|
|||||||
|
|
||||||
task updateVersion << {
|
task updateVersion << {
|
||||||
|
|
||||||
def grgit = Grgit.open(project.file('.').parent)
|
|
||||||
|
|
||||||
def jmeGitHash = grgit.head().id
|
|
||||||
def jmeShortGitHash = grgit.head().abbreviatedId
|
|
||||||
def jmeBuildDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date())
|
|
||||||
def jmeBranchName = grgit.branch.current.name
|
|
||||||
|
|
||||||
def verfile = file('src/main/java/com/jme3/system/JmeVersion.java')
|
def verfile = file('src/main/java/com/jme3/system/JmeVersion.java')
|
||||||
|
def jmeGitHash
|
||||||
|
def jmeShortGitHash
|
||||||
|
def jmeBuildDate
|
||||||
|
def jmeBranchName
|
||||||
|
|
||||||
|
try {
|
||||||
|
def grgit = Grgit.open(project.file('.').parent)
|
||||||
|
jmeGitHash = grgit.head().id
|
||||||
|
jmeShortGitHash = grgit.head().abbreviatedId
|
||||||
|
jmeBuildDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date())
|
||||||
|
jmeBranchName = grgit.branch.current.name
|
||||||
|
} catch (ex) {
|
||||||
|
// Failed to get repo info
|
||||||
|
logger.warn("Failed to get repository info: " + ex.message + ". " + \
|
||||||
|
"Only partial build info will be generated.")
|
||||||
|
|
||||||
|
jmeGitHash = ""
|
||||||
|
jmeShortGitHash = ""
|
||||||
|
jmeBuildDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date())
|
||||||
|
jmeBranchName = "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
verfile.text = "\npackage com.jme3.system;\n\n" +
|
verfile.text = "\npackage com.jme3.system;\n\n" +
|
||||||
"/**\n * THIS IS AN AUTO-GENERATED FILE..\n * DO NOT MODIFY!\n */\n" +
|
"/**\n * THIS IS AN AUTO-GENERATED FILE..\n * DO NOT MODIFY!\n */\n" +
|
||||||
"public class JmeVersion {\n" +
|
"public class JmeVersion {\n" +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user