diff options
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/build.gradle b/build.gradle index e70b4abc..e8413256 100644 --- a/build.gradle +++ b/build.gradle @@ -2,15 +2,41 @@ subprojects { apply plugin: 'java' apply plugin: 'eclipse' - repositories { - mavenCentral() - } + repositories { mavenCentral() } dependencies { testCompile 'junit:junit:4.8.2' } sourceCompatibility = 1.5 version = '4.0.0-SNAPSHOT' + pdfasversion = version + revision = getCheckedOutGitCommitHash() + + jar { manifest.attributes provider: 'EGIZ', 'Specification-Version': getCheckedOutGitCommitHash(), 'Implementation-Version': version } +} + +def getCheckedOutGitCommitHash() { + def gitFolder = "$projectDir/.git/" + def takeFromHash = 40 + /* + * '.git/HEAD' contains either + * in case of detached head: the currently checked out commit hash + * otherwise: a reference to a file containing the current commit hash + */ + def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD + def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd + // def isRef = head.length > 1 // ref: refs/heads/master + + if(isCommit) return head[0].trim().take(takeFromHash) // e5a7c79edabb + + def refHead = new File(gitFolder + head[1].trim()) // .git/refs/heads/master + refHead.text.trim().take takeFromHash +} - jar { manifest.attributes provider: 'EGIZ' } +task docs(type: Javadoc) { + source subprojects.collect {project -> project.sourceSets.main.allJava } + classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath}) + destinationDir = new File(projectDir, 'docs') } + + |