Another option, which also does not have support for incremental builds, is to make the zip creation a function. Then just call the function with each of the different parameters. However, I think dynamically creating the task (as suggested by Etienne) might be the best option. Tasks have groups, is there a "don't show me" group you could put the tasks in so that they don't clutter a "gradle -t" list? This would allow "private" tasks, like Ant has with tasks that start with a '-'.
On Fri, Dec 3, 2010 at 2:41 PM, Etienne Studer <[email protected]>wrote: > If you use the ant.zip approach in your task, you will not have support for > incremental builds, I believe. Just my two cents... > > Etienne > > > On 03.12.2010, at 16:53, Robert Fischer wrote: > > > Since the user is never calling these things individually, I probably > > wouldn't approach this as a bunch of tasks. Instead, I'd probably > > create one Gradle task to accomplish this and then use the Ant zip > > task through the project's "ant" property. > > > > http://ant.apache.org/manual/Tasks/zip.html > > > > ~~ Robert. > > > > > > > > On 3 December 2010 09:38, richardm <[email protected]> > wrote: > >> > >> Is is possible to call a task in Gradle with different parameters? I've > got > >> a zip task which I'd like to call several times. The project below > defines > >> a single zip task which uses a properties file to apply filters during > the > >> zip. I need to create 4 zip files like this (the only differences are > the > >> zip names and the properties file used to filter with). Is it possible > to > >> do this with one task and call it four times with different parameters? > >> > >> project(':jboss') { > >> > >> Properties jboss4LiveProps = new Properties() > >> jboss4LiveProps.load(new > >> FileInputStream("$projectDir/property-files/jboss4-live.properties")) > >> > >> dependsOn(':otherProject') > >> > >> filesToDeploy = dir('files_to_deploy') > >> > >> task zipIt(type: Zip, dependsOn: filesToDeploy) { > >> baseName = 'jboss-4.0.2-live' > >> destinationDir = file("files_to_deploy") > >> from ('jboss-4.0.2-master') { > >> include "**/*.xml", "**/*.bat", "**/*.sh", "**/*properties" > >> filter(ReplaceTokens, tokens: jboss4LiveProps) > >> into 'jboss-4.0.2-live' > >> } > >> from ..... > >> > >> } > >> > >> task build(dependsOn: 'zipIt') > >> > >> } > >> -- > >> View this message in context: > http://gradle.1045684.n5.nabble.com/calling-task-multiple-times-with-different-parameters-tp3290970p3290970.html > >> Sent from the gradle-user mailing list archive at Nabble.com. > >> > >> --------------------------------------------------------------------- > >> To unsubscribe from this list, please visit: > >> > >> http://xircles.codehaus.org/manage_email > >> > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe from this list, please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > Etienne Studer > Senior Software Developer > > Canoo Engineering AG > Kirschgartenstrasse 5 > CH-4051 Basel > > T +41 61 228 94 44 > F +41 61 228 94 49 > > [email protected] > www.canoo.com > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > -- John Murph Automated Logic Research Team
