Include tag message if possible

This commit is contained in:
Johannes Frohnmeyer 2021-12-16 17:17:09 +00:00
parent 4ebc097bde
commit 1f44385268
1 changed files with 9 additions and 3 deletions

View File

@ -67,7 +67,7 @@ ext.moduleDependencies = { Project project, List<String> depNames ->
}
// Fetch changelog
def changelogStr = "No changelog"
def changelogStr = ""
ext.currentVer = "0.0.0+nogit"
ext.currentType = VersionType.ALPHA
if (grgit != null) {
@ -76,6 +76,9 @@ if (grgit != null) {
def tagList = grgit.tag.list()
tagList.sort((left, right) -> right.commit.dateTime.compareTo(left.commit.dateTime))
if (tagList.size() >= 1) {
if (tagList.get(0).fullMessage != null) {
changelogStr += tagList.get(0).fullMessage + "\n"
}
ext.currentType = VersionType.RELEASE
ext.currentVer = tagList.get(0).getName()
switch (ext.currentVer[0]) {
@ -92,11 +95,14 @@ if (grgit != null) {
break
}
if (tagList.size() >= 2) {
changelogStr = "Commits in " + ext.currentType.toString().toLowerCase() + " " + ext.currentVer + ":"
changelogStr += "Commits in " + ext.currentType.toString().toLowerCase() + " " + ext.currentVer + ":\n"
for (def commit : grgit.log{range(tagList.get(1).fullName, tagList.get(0).fullName)}) {
changelogStr += "\n- " + commit.shortMessage
changelogStr += "- " + commit.shortMessage + "\n"
}
}
else {
changelogStr += "No commits"
}
}
}
if (!project.hasProperty("release")) {