@@ -81,6 +81,10 @@ abstract class AddReleaseDropDown extends DefaultTask {
81
81
void addReleaseDropDown () {
82
82
String projectVersion = version. get()
83
83
84
+ final Object result = listRepoTags(" apache/grails-core" )
85
+ List<SoftwareVersion > softwareVersions = parseSoftwareVersions(result)
86
+ logger. lifecycle(" Detected Project Version: ${ projectVersion} and Software Versions: ${ softwareVersions*.versionText.join(',')} " )
87
+
84
88
final String versionHtml = " <p><strong>Version:</strong> ${ projectVersion} </p>"
85
89
Path guideDirectory = docsDirectory. get(). asFile. toPath()
86
90
Path targetOutputDirectory = outputDir. get(). asFile. toPath()
@@ -107,7 +111,7 @@ abstract class AddReleaseDropDown extends DefaultTask {
107
111
if (filesToChange. containsKey(absolutePath)) {
108
112
// Need to add the version dropdown
109
113
String page = guideDirectory. toFile(). relativePath(file. toFile())
110
- String selectHtml = select(options(projectVersion, page))
114
+ String selectHtml = select(options(projectVersion, page, softwareVersions ))
111
115
112
116
final String versionWithSelectHtml = " <p><strong>Version:</strong> <span style='width:100px;display:inline-block;'>${ selectHtml} </span></p>"
113
117
targetFile. toFile(). text = file. text. replace(versionHtml, versionWithSelectHtml)
@@ -130,15 +134,15 @@ abstract class AddReleaseDropDown extends DefaultTask {
130
134
*
131
135
* @param version The current version of the documentation
132
136
* @param page The page to add the dropdown to
137
+ * @param softwareVersions The list of software versions to include in the dropdown
133
138
* @return The list of options for the select tag
134
139
*/
135
- private List<String > options (String version , String page ) {
140
+ private List<String > options (String version , String page , List< SoftwareVersion > softwareVersions ) {
136
141
List<String > options = []
137
142
final String snapshotHref = GRAILS_DOC_BASE_URL + " /snapshot" + page
138
143
options << option(snapshotHref, " SNAPSHOT" , version. endsWith(" -SNAPSHOT" ))
139
144
140
- final Object result = listRepoTags(" apache/grails-core" )
141
- parseSoftwareVersions(result)
145
+ softwareVersions
142
146
.forEach { softwareVersion ->
143
147
final String versionName = softwareVersion. versionText
144
148
final String href = GRAILS_DOC_BASE_URL + " /" + versionName + page
0 commit comments