diff options
-rw-r--r-- | moaSig/build.gradle | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/moaSig/build.gradle b/moaSig/build.gradle index ada954f..738ebbc 100644 --- a/moaSig/build.gradle +++ b/moaSig/build.gradle @@ -21,13 +21,21 @@ subprojects { testCompile 'junit:junit:4.8.2' } - version = '3.0.0-RC5' + version = '3.0.0' - jar { - manifest.attributes provider: 'EGIZ' - } + jar { manifest.attributes provider: 'EGIZ', 'Specification-Version': getCheckedOutGitCommitHash(), 'Implementation-Version': project.version } } task wrapper(type: Wrapper) { gradleVersion = '2.8' -}
\ No newline at end of file +} + +def getCheckedOutGitCommitHash() { + def gitFolder = "$projectDir/.git/" + def takeFromHash = 40 + def head = new File(gitFolder + "HEAD").text.split(":") + def isCommit = head.length == 1 + if(isCommit) return head[0].trim().take(takeFromHash) + def refHead = new File(gitFolder + head[1].trim()) + refHead.text.trim().take takeFromHash +} |