mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 00:02:06 +01:00
[gradle] Use 'projectDirFile' File instance in getGitCommit()
The previous construct def projectDir = dotGit.getParentFile() was a little bit strange (and its declaration shadows the projectDir String property).
This commit is contained in:
parent
11e38f9ba5
commit
45e865757a
1 changed files with 4 additions and 4 deletions
|
@ -686,19 +686,19 @@ task sinttestAll {
|
||||||
}
|
}
|
||||||
|
|
||||||
def getGitCommit() {
|
def getGitCommit() {
|
||||||
def dotGit = new File("$projectDir/.git")
|
def projectDirFile = new File("$projectDir")
|
||||||
|
def dotGit = new File(projectDirFile, ".git")
|
||||||
if (!dotGit.isDirectory()) return 'non-git build'
|
if (!dotGit.isDirectory()) return 'non-git build'
|
||||||
|
|
||||||
def projectDir = dotGit.getParentFile()
|
|
||||||
def cmd = 'git describe --always --tags --dirty=+'
|
def cmd = 'git describe --always --tags --dirty=+'
|
||||||
def proc = cmd.execute(null, projectDir)
|
def proc = cmd.execute(null, projectDirFile)
|
||||||
proc.waitForOrKill(10 * 1000)
|
proc.waitForOrKill(10 * 1000)
|
||||||
|
|
||||||
def gitCommit = proc.text.trim()
|
def gitCommit = proc.text.trim()
|
||||||
assert !gitCommit.isEmpty()
|
assert !gitCommit.isEmpty()
|
||||||
|
|
||||||
def srCmd = 'git symbolic-ref --short HEAD'
|
def srCmd = 'git symbolic-ref --short HEAD'
|
||||||
def srProc = srCmd.execute(null, projectDir)
|
def srProc = srCmd.execute(null, projectDirFile)
|
||||||
srProc.waitForOrKill(10 * 1000)
|
srProc.waitForOrKill(10 * 1000)
|
||||||
if (srProc.exitValue() == 0) {
|
if (srProc.exitValue() == 0) {
|
||||||
// Only add the information if the git command was
|
// Only add the information if the git command was
|
||||||
|
|
Loading…
Reference in a new issue