net.sf.antcontrib.p2psockets
Class Release
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
net.sf.antcontrib.p2psockets.Release
- public class Release
- extends org.apache.tools.ant.Task
This class implements a new custom tag for Ant, the <release> tag.
This tag makes it easy for an open-source project to follow
the Linux release style, which is to have even version numbers on the
second digit indicate stable releases (1.2, 1.4, etc.) and odd version
numbers on the second digit indicate unstable releases (1.1, 1.3,
including 1.5.2 since the second digit is odd).
To use, in your ant file add the release tag:
<release destdir="c:\\paperairplane\\www" name="paperairplane"
origfile="distributable.zip" ending=".zip"/>
home="${p2psockets_home}"
When calling your Ant file, you must define the system property 'release', such as:
ant sometask -Drelease=1.1
The release tag will then take the original file defined in the property origfile,
rename it to name plus the release value given in -Drelease (where all decimals
are changed into underscores), and add the ending ending. In the example above
the file distributable.zip will be renamed to paperairplane1_1.zip.
If the shell property-Ddatestamp=true is true, then a date stamp will be added
after the release number, such as paperairplane1_1-2003-11-06.zip.
After generating this file name, the original distributable.zip will be moved over to a particular
directory given by destdir. This task will create the following subdirectories under the directory
given by destdir if they aren't there: a releases directory and releases/stable and
releases/unstable. This task will copy the generated file to the correct location based
on whether it is odd or even on the second digit. In the example above, since the release is 1.1
or an unstable release, the paperairplane1_1-2003-11-06.zip file will be copied to
c:\\paperairplane\\www\\releases\\unstable.
The file given in origfile will be removed.
As a side effect, this task will also create a property named "distributable-cvs-filename", which can
be used in other ant tasks, such as checking the file into CVS. This task returns the full file
location, rooted from where CVS begins. This is calculated by removing the filename given
by the 'home' attribute above from the distributable's filename. For example, if 'home' is
set to "c:/p2psockets" and the distributable filename generated by this Release class is
'c:/p2psockets/www/releases/unstable/p2psockets-1_1-2004-01-13.zip', then 'distributable-cvs-filename'
would be set to 'www/releases/unstable/p2psockets-1_1-2004-01-13.zip'.
- Version:
- 0,1
- Author:
- Brad Neuberg, bkn3@columbia.edu
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Release
public Release()
setDestdir
public void setDestdir(java.lang.String destdir)
setName
public void setName(java.lang.String name)
setOrigfile
public void setOrigfile(java.lang.String origfile)
setEnding
public void setEnding(java.lang.String ending)
setHome
public void setHome(java.lang.String home)
execute
public void execute()
throws org.apache.tools.ant.BuildException
- Throws:
org.apache.tools.ant.BuildException