How 'bout:

['standard', 'nonStandard', 'customDir'].each { target ->
    task("init${target.capitalize()}DirProject", type: Exec) {
        workingDir "src/test/resources/projects/${target}"
        commandLine 'bower', 'install'
        inputs.files new File(workingDir, 'component.json')
        outputs.files new File(workingDir, 'web-app')
    }
}


On Thu, Dec 20, 2012 at 4:48 PM, Robert Fletcher <
robert.w.fletc...@gmail.com> wrote:

> Hi
>
> I'm doing several very similar Exec tasks which only vary based on their
> `workingDir`. The `commandLine` is the same in each case and incremental
> build inputs & outputs are a function of the `workingDir`. Instead of
> repeating myself is there a way I can define a new task as a pre-configured
> Exec task?
>
> Sorry if that's confusing. The build I'm talking about is here:
> https://github.com/robfletcher/gazebo/blob/master/build.gradle#L15
>
> Rob
>

Reply via email to