Hi Hans,

On 25.10.2009, at 06:00, Hans Dockter wrote:

Hi Peter,

On Oct 21, 2009, at 11:30 AM, Peter Voss wrote:

Hi,

the user guide has a nice example on how to generate different version number for release build by evaluating the taskGraph. How can I use this together with Zip tasks? I need the version number in my zip task, but the task gets fully evaluated and all variables expanded on task creation. It's too late to change the project version number after that.

Here is a minimal example:

build.gradle:
usePlugin "java"

task release(dependsOn: 'dist') << {
  println "Created release for version ${version}"
}

task dist(type: Zip) {
  println "Created zip task with version $version"
  zipFileSet(dir: projectDir, prefix: "$name-$version") {
      include("build.gradle")
  }
}

The zipFileSet is the problem. In 0.8 it does early evaluation. This is fixed in trunk where it evaluates late.
As a work around you can do:

task dist(type: Zip) {
   println ....
   doFirst { task ->
      task.zipFileZet ...
}

Thanks for this workaround. I have used the zip ant task to work around this. I will move back to gradle's zip task type as soon as I have updated gradle.

--Peter


- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
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