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 <[email protected]> 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 }
