4

I'm doing a project at uni and would like to create zip files which name (just a build number) increments after each successful build.

What's the easiest way to do this? Is it a case of having to write a custom task? Or is there some built in functionality that will allow me to do this simply and easily?

I did have a look at the Zip task manual, but couldn't spot anything that might be useful.

martin clayton
  • 76,436
  • 32
  • 213
  • 198

3 Answers3

6

Have you seen the BuildNumber task?

Run that task, and then name the zip file based on the property.

martin clayton
  • 76,436
  • 32
  • 213
  • 198
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
0

One easy alternative solution would be to include a timestamp into your file name:

myapp_20090326-1522.zip for the build made on 2009-03-26 at 15:22.

That's what many projects do. Also avoids problems if multiple people may create builds on their machines; you don't need to coordinate build numbers.

sleske
  • 81,358
  • 34
  • 189
  • 227
0

If you use a Hudson CI server to build your project, you can use the Hudson build number. Here's a quick example of getting the BUILD_NUMBER environment variable (which is injected by Hudson):

<property environment="env" description="System environment variables (including those set by Hudson)"/>
<!-- set the build number based on environment variable, otherwise blank -->
<condition property="buildNumber" value=".${env.BUILD_NUMBER}" else="">
    <isset property="env.BUILD_NUMBER" />
</condition>
Jeff Olson
  • 6,323
  • 2
  • 22
  • 26