Skip to content
Snippets Groups Projects
Commit 31349c55 authored by User expired's avatar User expired
Browse files

added changelog generation to build process

  (by now the changelog is not checked in into git)
parent bc0b4ddc
No related branches found
No related tags found
No related merge requests found
......@@ -107,6 +107,25 @@ def getDate() {
return formattedDate
}
def readGitTags() {
def tags = []
def proc = "git tag".execute()
proc.in.eachLine { line -> tags += line}
Collections.reverse( tags )
tags
}
def readGitMessages(String tag, String prevTag) {
def message = []
def range = (prevTag == null || prevTag == "") ? "$tag" : "$prevTag..$tag"
def proc = "git log $range --oneline --no-merges".execute()
proc.in.eachLine { line -> message += line }
proc.err.eachLine { line -> println line }
message
}
// Detailled settings (dependencies, tasks, task configuration, ...)
repositories {
......@@ -276,6 +295,25 @@ vagrantDestroy.doFirst {
// Custom task definitions
task changelog << {
def fileChangelog = new File('CHANGELOG.md')
def tags = ["HEAD"] + readGitTags()
def numTags = tags.size();
def prevTag
def tag
fileChangelog.delete()
for (int i = 0; i < numTags; i++) {
tag = tags[i];
prevTag = tags[i+1]
fileChangelog << "- Version ${tag}:\n".replaceAll("Version HEAD", "Upcoming version")
def message = readGitMessages(tag, prevTag)
message.each{fileChangelog << " - $it\n"}
fileChangelog << "\n"
}
}
task cleanAfterDaily(type: Delete) {
delete "$buildDir/dependency-cache"
delete "$buildDir/tmp"
......@@ -371,7 +409,7 @@ task vagrantPrepare << {
task jarAll(dependsOn: [jar, javadocJar, sourcesJar, staticJar, testJar])
task buildAll(dependsOn: [jarAll, build])
task daily(dependsOn: [clean, asciidoctor, check, javadoc, jarAll])
task daily(dependsOn: [clean, asciidoctor, changelog, check, javadoc, jarAll])
task release
// task dependencies
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment