Generate channel summaries in release notes
The release note automation now generates
the summary summary list that we use in
the channel summaries. It puts it on every
file just for consistency.
Fixes: 157991812
Test: ./generateReleaseNotes.py 1593018000000
Test: ./testReleaseNotes.py
Change-Id: I0297094b1b47f949afe231e7855501a3337b1a71
diff --git a/development/release-notes/AndroidXMarkdown.py b/development/release-notes/AndroidXMarkdown.py
index 6a57d59..f4803d4 100644
--- a/development/release-notes/AndroidXMarkdown.py
+++ b/development/release-notes/AndroidXMarkdown.py
@@ -109,6 +109,19 @@
self.markdownType = HeaderType.H3
self.text = "%s Version %s {:#%s%s}" % (groupId, version, artifactIdTag, version)
+class ChannelSummaryItem:
+ """Generates the summary list item in the channel.md pages, which take the format:
+
+ * [<Title> Version <version>](/jetpack/androidx/releases/<groupid>#<version>)
+
+ where <header> is usually the GroupId.
+ """
+ def __init__(self, formattedTitle, groupId, version, artifactIdTag=""):
+ self.text = "* [%s Version %s](/jetpack/androidx/releases/%s#%s%s)\n" % (formattedTitle, version, groupId.lower(), artifactIdTag, version)
+
+ def __str__(self):
+ return self.text
+
class LibraryReleaseNotes:
""" Structured release notes class, that connects all parts of the release notes. Creates release
notes in the format:
@@ -156,6 +169,7 @@
self.commitMarkdownList = CommitMarkdownList(commitList, forceIncludeAllCommits)
self.summary = ""
self.bugsFixed = []
+ self.channelSummary = None
if version == "" or groupId == "":
raise RuntimeError("Tried to create Library Release Notes Header without setting " +
@@ -164,6 +178,7 @@
formattedGroupId = groupId.replace("androidx.", "")
formattedGroupId = self.capitalizeTitle(formattedGroupId)
self.header = LibraryHeader(formattedGroupId, version)
+ self.channelSummary = ChannelSummaryItem(formattedGroupId, formattedGroupId, version)
else:
artifactIdTag = artifactIds[0] + "-" if len(artifactIds) == 1 else ""
formattedArtifactIds = (" ".join(artifactIds))
@@ -171,6 +186,8 @@
formattedArtifactIds = groupId.replace("androidx.", "")
formattedArtifactIds = self.capitalizeTitle(formattedArtifactIds)
self.header = LibraryHeader(formattedArtifactIds, version, artifactIdTag)
+ formattedGroupId = groupId.replace("androidx.", "")
+ self.channelSummary = ChannelSummaryItem(formattedArtifactIds, formattedGroupId, version, artifactIdTag)
self.diffLogLink = getGitilesDiffLogLink(version, fromSHA, untilSHA, projectDir)
def getFormattedReleaseSummary(self):