You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/06/14 17:02:01 UTC

(grails-core) branch 7.0.x updated: Add logging & reduce Github API calls

This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 176fb8f171 Add logging & reduce Github API calls
176fb8f171 is described below

commit 176fb8f1717d5de43634e1976b6c8a80cfe1d81c
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Sat Jun 14 13:01:38 2025 -0400

    Add logging & reduce Github API calls
---
 .../src/main/groovy/grails/doc/AddReleaseDropDown.groovy     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/buildSrc/src/main/groovy/grails/doc/AddReleaseDropDown.groovy b/buildSrc/src/main/groovy/grails/doc/AddReleaseDropDown.groovy
index 8e63972727..c40913834f 100644
--- a/buildSrc/src/main/groovy/grails/doc/AddReleaseDropDown.groovy
+++ b/buildSrc/src/main/groovy/grails/doc/AddReleaseDropDown.groovy
@@ -81,6 +81,10 @@ abstract class AddReleaseDropDown extends DefaultTask {
     void addReleaseDropDown() {
         String projectVersion = version.get()
 
+        final Object result = listRepoTags("apache/grails-core")
+        List<SoftwareVersion> softwareVersions = parseSoftwareVersions(result)
+        logger.lifecycle("Detected Project Version: ${projectVersion} and Software Versions: ${softwareVersions*.versionText.join(',')}")
+
         final String versionHtml = "<p><strong>Version:</strong> ${projectVersion}</p>"
         Path guideDirectory = docsDirectory.get().asFile.toPath()
         Path targetOutputDirectory = outputDir.get().asFile.toPath()
@@ -107,7 +111,7 @@ abstract class AddReleaseDropDown extends DefaultTask {
                 if (filesToChange.containsKey(absolutePath)) {
                     //Need to add the version dropdown
                     String page = guideDirectory.toFile().relativePath(file.toFile())
-                    String selectHtml = select(options(projectVersion, page))
+                    String selectHtml = select(options(projectVersion, page, softwareVersions))
 
                     final String versionWithSelectHtml = "<p><strong>Version:</strong>&nbsp;<span style='width:100px;display:inline-block;'>${selectHtml}</span></p>"
                     targetFile.toFile().text = file.text.replace(versionHtml, versionWithSelectHtml)
@@ -130,15 +134,15 @@ abstract class AddReleaseDropDown extends DefaultTask {
      *
      * @param version The current version of the documentation
      * @param page The page to add the dropdown to
+     * @param softwareVersions The list of software versions to include in the dropdown
      * @return The list of options for the select tag
      */
-    private List<String> options(String version, String page) {
+    private List<String> options(String version, String page, List<SoftwareVersion> softwareVersions) {
         List<String> options = []
         final String snapshotHref = GRAILS_DOC_BASE_URL + "/snapshot" + page
         options << option(snapshotHref, "SNAPSHOT", version.endsWith("-SNAPSHOT"))
 
-        final Object result = listRepoTags("apache/grails-core")
-        parseSoftwareVersions(result)
+        softwareVersions
                 .forEach { softwareVersion ->
                     final String versionName = softwareVersion.versionText
                     final String href = GRAILS_DOC_BASE_URL + "/" + versionName  + page