From aecd791eacd2acb2104c270c57782592dce05aed Mon Sep 17 00:00:00 2001 From: Roberto Perez Alcolea Date: Mon, 4 Nov 2019 14:39:56 -0800 Subject: [PATCH] Revert "Revert "tasks.withType: use configureEach"" This reverts commit 26800bd59a78f82e97782f3001dc472222ce2595. --- .../plugin/stash/StashRestBasePlugin.groovy | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/groovy/nebula/plugin/stash/StashRestBasePlugin.groovy b/src/main/groovy/nebula/plugin/stash/StashRestBasePlugin.groovy index 36a9adc..5ca7498 100644 --- a/src/main/groovy/nebula/plugin/stash/StashRestBasePlugin.groovy +++ b/src/main/groovy/nebula/plugin/stash/StashRestBasePlugin.groovy @@ -1,6 +1,7 @@ package nebula.plugin.stash import nebula.plugin.stash.tasks.StashTask +import org.gradle.api.Action import org.gradle.api.Plugin import org.gradle.api.Project @@ -14,12 +15,15 @@ class StashRestBasePlugin implements Plugin { } private void configureStashTasks(Project project, StashPluginExtension extension) { - project.tasks.withType(StashTask) { - conventionMapping.stashRepo = { project.hasProperty('stashRepo') ? project.stashRepo : extension.stashRepo } - conventionMapping.stashProject = { project.hasProperty('stashProject') ? project.stashProject : extension.stashProject } - conventionMapping.stashHost = { project.hasProperty('stashHost') ? project.stashHost : extension.stashHost } - conventionMapping.stashUser = { project.hasProperty('stashUser') ? project.stashUser : extension.stashUser } - conventionMapping.stashPassword = { project.hasProperty('stashPassword') ? project.stashPassword : extension.stashPassword } - } + project.tasks.withType(StashTask).configureEach(new Action() { + @Override + void execute(StashTask stashTask) { + stashTask.conventionMapping.stashRepo = { project.hasProperty('stashRepo') ? project.stashRepo : extension.stashRepo } + stashTask. conventionMapping.stashProject = { project.hasProperty('stashProject') ? project.stashProject : extension.stashProject } + stashTask. conventionMapping.stashHost = { project.hasProperty('stashHost') ? project.stashHost : extension.stashHost } + stashTask.conventionMapping.stashUser = { project.hasProperty('stashUser') ? project.stashUser : extension.stashUser } + stashTask.conventionMapping.stashPassword = { project.hasProperty('stashPassword') ? project.stashPassword : extension.stashPassword } + } + }) } }