All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javaposse.jobdsl.dsl.helpers.step.StepContextHelper.groovy Maven / Gradle / Ivy

There is a newer version: 1.22-rxd-2
Show newest version
package javaposse.jobdsl.dsl.helpers.step

import com.google.common.base.Preconditions
import javaposse.jobdsl.dsl.JobType
import javaposse.jobdsl.dsl.WithXmlAction
import javaposse.jobdsl.dsl.helpers.AbstractContextHelper

class StepContextHelper extends AbstractContextHelper {

    StepContextHelper(List withXmlActions, JobType jobType) {
        super(withXmlActions, jobType)
    }

    def steps(Closure closure) {
        Preconditions.checkState(type != JobType.Maven, "steps cannot be applied for Maven jobs")
        execute(closure, new StepContext(type))
    }

    Closure generateWithXmlClosure(StepContext context) {
        return { Node project ->
            def buildersNode
            if (project.builders.isEmpty()) {
                buildersNode = project.appendNode('builders')
            } else {
                buildersNode = project.builders[0]
            }
            context.stepNodes.each {
                buildersNode << it
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy