-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
70 lines (58 loc) · 1.65 KB
/
Copy pathbuild.gradle
File metadata and controls
70 lines (58 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'org.pegdown:pegdown:1.4.1'
}
}
import org.pegdown.PegDownProcessor
import groovy.text.SimpleTemplateEngine
def readTags() {
def tags = []
def proc = "git tag -l".execute()
proc.in.eachLine { line -> tags += line}
tags.sort {}
Collections.reverse( tags )
tags
}
def readTagMessage(String tag) {
def message = []
def proc = "git cat-file tag $tag".execute()
def startCollection = false
proc.in.eachLine { line ->
if (line.isEmpty()) {
startCollection = true
}
if (startCollection) {
message += line
}
}
proc.err.eachLine { line -> println line }
message
}
task releaseNotes() << {
def releaseNotes = new File('releaseNotes.md')
releaseNotes.delete()
def versions = ""
def tags = readTags()
tags.each {tag ->
versions += "- [$tag](#$tag)\n"
}
tags.each {tag ->
releaseNotes << "# ${tag}<a name='$tag'></a>\n"
def message = readTagMessage(tag)
message.each{releaseNotes << "$it\n"}
releaseNotes << "\n"
}
def writer = new StringWriter()
def pdp = new PegDownProcessor()
def engine = new SimpleTemplateEngine()
def template = engine.createTemplate(new File("releaseNotes.tpl"))
def daten = [releaseNotes:pdp.markdownToHtml(new File("releaseNotes.md").text), application: project.name, versions:pdp.markdownToHtml(versions)]
def ergebnis = template.make(daten)
new File('releaseNotes.html').withWriter { w ->
w.write(ergebnis)
}
}