You are viewing a plain text version of this content. The canonical link for it is here.
Posted to geb-notifications@groovy.apache.org by jo...@apache.org on 2025/02/05 21:06:08 UTC

(groovy-geb) branch jonny-static-website-feedback created (now 86ea57fe)

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

jonnybot pushed a change to branch jonny-static-website-feedback
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git


      at 86ea57fe Pass BaseExtension as argument

This branch includes the following new commits:

     new 5fbe91d5 Pass manuals extension for better IDE hinting
     new 86ea57fe Pass BaseExtension as argument

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(groovy-geb) 01/02: Pass manuals extension for better IDE hinting

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jonnybot pushed a commit to branch jonny-static-website-feedback
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git

commit 5fbe91d5ab6eb4dd8e631eb1a9dec4771840cb12
Author: Jonny Carter <jc...@adaptavist.com>
AuthorDate: Wed Feb 5 15:03:58 2025 -0600

    Pass manuals extension for better IDE hinting
    
    Also, use .set method on destinationFile property
---
 .../src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy    | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy b/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy
index ed7749e0..af3380ba 100644
--- a/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy
@@ -42,7 +42,7 @@ class ManualsPlugin implements Plugin<Project> {
         ManualsExtension manualsExtension = project.extensions.create('manuals', ManualsExtension, project)
 
         configureCurrentManualGathering(project, baseExtension, manualsExtension, gatherManualsTask)
-        configureIndexTask(project)
+        configureIndexTask(project, manualsExtension)
     }
 
     private void configureCurrentManualGathering(
@@ -60,18 +60,17 @@ class ManualsPlugin implements Plugin<Project> {
         }
     }
 
-    private void configureIndexTask(Project project) {
+    private void configureIndexTask(Project project, ManualsExtension manualsExtension) {
         project.tasks.register("generateIndex", WriteProperties) {
-            destinationFile = project.layout.buildDirectory.file("index.html")
+            destinationFile.set(project.layout.buildDirectory.file("index.html"))
             doLast {
                 def baseExtension = project.extensions.getByType(BaseExtension)
-                def ext = project.extensions.getByName("manuals")
-                List<String> includedManuals = ext.includedManuals.get()
+                List<String> includedManuals = manualsExtension.includedManuals.get()
                 String currentVersion = baseExtension.isSnapshot() ? includedManuals.last() : project.version
                 String snapshot = baseExtension.isSnapshot() ? project.version : ''
                 List<String> oldManuals = includedManuals.findAll {v -> v != currentVersion }
                 Map<String, String> model = [old: oldManuals, current: currentVersion, snapshot: snapshot]
-                String template = readFileContent(ext.indexTemplate.asFile.get())
+                String template = readFileContent(manualsExtension.indexTemplate.asFile.get())
                 String html = new SimpleTemplateEngine().createTemplate(template).make(model).toString()
                 destinationFile.get().asFile.text = html
             }


(groovy-geb) 02/02: Pass BaseExtension as argument

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jonnybot pushed a commit to branch jonny-static-website-feedback
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git

commit 86ea57fe9998b1f7797ce293ccd7db5dbf57c569
Author: Jonny Carter <jc...@adaptavist.com>
AuthorDate: Wed Feb 5 15:05:07 2025 -0600

    Pass BaseExtension as argument
---
 buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy b/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy
index af3380ba..be610e00 100644
--- a/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy
@@ -42,7 +42,7 @@ class ManualsPlugin implements Plugin<Project> {
         ManualsExtension manualsExtension = project.extensions.create('manuals', ManualsExtension, project)
 
         configureCurrentManualGathering(project, baseExtension, manualsExtension, gatherManualsTask)
-        configureIndexTask(project, manualsExtension)
+        configureIndexTask(project, baseExtension, manualsExtension)
     }
 
     private void configureCurrentManualGathering(
@@ -60,11 +60,10 @@ class ManualsPlugin implements Plugin<Project> {
         }
     }
 
-    private void configureIndexTask(Project project, ManualsExtension manualsExtension) {
+    private void configureIndexTask(Project project, BaseExtension baseExtension, ManualsExtension manualsExtension) {
         project.tasks.register("generateIndex", WriteProperties) {
             destinationFile.set(project.layout.buildDirectory.file("index.html"))
             doLast {
-                def baseExtension = project.extensions.getByType(BaseExtension)
                 List<String> includedManuals = manualsExtension.includedManuals.get()
                 String currentVersion = baseExtension.isSnapshot() ? includedManuals.last() : project.version
                 String snapshot = baseExtension.isSnapshot() ? project.version : ''