mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-03 01:29:33 +00:00
30 lines
599 B
Groovy
30 lines
599 B
Groovy
/**
|
|
* returns current git hash
|
|
*/
|
|
def getGitHash = { ->
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine "git", "log", "-n", "1", "--format='%h'"
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim().replace("'", "")
|
|
}
|
|
|
|
/**
|
|
* set git hash into git.xml
|
|
*/
|
|
preBuild.doLast {
|
|
copy {
|
|
from ("../git.template.xml")
|
|
|
|
into ("res/values")
|
|
|
|
rename {
|
|
String fileName -> fileName.replace(".template", "")
|
|
}
|
|
|
|
filter {
|
|
String line -> line.replaceAll("#GITHASH#", getGitHash())
|
|
}
|
|
}
|
|
} |