Eitan,

The one correct to make after closer eval is you would want to strip the 
"package" of the ${env} otherwise not  a bad approach.

Ken Sipe | [email protected] | blog: http://kensipe.blogspot.com



On Apr 13, 2011, at 12:13 PM, Eitan Suez wrote:

> [gmail crashed on my first send, sorry if it ends up getting sent twice]
> hello,
> 
> i'm a gradle newb.  first of all i'd like to say thank you for gradle.
> 
> i'm trying to write a task that creates a set of zip files, one per
> environment.  something like this:
> 
> task packageEnvironments {
>      description = "Package environment-specific artifacts."
> 
>      doLast {
>              ['branch', 'stage', 'production', 'released'].each { envName ->
>                      println "Packaging runtime environment: ${envName}"
>                      zip {
>                              appendix = envName
>                              into "catalina/${envName}"
>                              from "env/webapp/${envName}/catalina"
>                              into('lib') {
>                                      from configurations.deploy2CatalinaLib
>                              }
>                      }
>              }
>      }
> }
> 
> except that, unlike the project.copy() action, there's no
> project.zip() action.  i sure would like one.
> further, i can't even figure out *how* to do this in gradle without
> a zip action.
> so far, i'm trying to coerce a task as an action like this:
> 
> task packageEnvironments {
>      description = "Package environment-specific artifacts."
> 
>      doLast {
>              task zipIt(type: Zip)
>              ['branch', 'stage', 'production', 'released'].each { envName ->
>                      println "Packaging runtime environment: ${envName}"
>                      zipIt.configure {
>                              appendix = envName
>                              into "catalina/${envName}"
>                              from "env/webapp/${envName}/catalina"
>                              into('lib') {
>                                      from configurations.deploy2CatalinaLib
>                              }
>                      }
>                      zipIt.execute()
>              }
>      }
> }
> 
> and it doesn't work.  it produces the first zip file, but is a no-op
> for the remainder
> (perhaps because the inputs/outputs have already been set and perhaps are
> immutable and so the next time around it figures the task is
> perhaps up to date?).
> 
> my experience *so far* with gradle is wonderful, with this one exception.
> 
> the main disconnect i have is wanting to compose tasks,
> wanting to invoke a task or think of a task as a function or something
> one can parameterize.  but can't.  perhaps i shouldn't and that's fine.
> 
> but sometimes there are all these tasks that one just wants to execute
> and can't because they're not executable like functions are.
> 
> perhaps what i'm asking for is action versions of the various tasks
> that gradle exposes?  i.e. a copy action (we have), a zip action (is
> there such
> a thing?), an exec action (?)..
> 
> often i find myself falling back to using an antbuilder task even when
> a gradle equivalent exists because i can treat an ant task as an action,
> something i can invoke with its configurations as arguments.  i.e. i
> often cannot
> figure out how to use the gradle equivalent properly.
> 
> anyhow, thanks in advance for any help figuring out how to get this 'zip in
> a for loop' task working.
> 
> / eitan
> 
> ---------------------------------------------------------------------
> 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


Reply via email to