Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Revert "Revert "tasks.withType: use configureEach""
Browse files Browse the repository at this point in the history
This reverts commit 26800bd.
  • Loading branch information
rpalcolea committed Nov 4, 2019
1 parent 26800bd commit aecd791
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/groovy/nebula/plugin/stash/StashRestBasePlugin.groovy
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,12 +15,15 @@ class StashRestBasePlugin implements Plugin<Project> {
}

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<StashTask>() {
@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 }
}
})
}
}

0 comments on commit aecd791

Please sign in to comment.