conor 01/01/04 03:13:18
Modified: . WHATSNEW
docs index.html
src/main/org/apache/tools/ant/taskdefs Tstamp.java
Log:
Add some error checking to new TSTAMP format element
Documentation fro tstamp and javac changes
Revision Changes Path
1.62 +10 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- WHATSNEW 2000/12/06 12:12:47 1.61
+++ WHATSNEW 2001/01/04 11:13:11 1.62
@@ -45,6 +45,16 @@
of the source files are no longer required to be at the end of the
command.
+* Ant now prints a warning when an attempt is made to use a property which
has
+ not been set. Any build files which rely on non-set properties being passed
+ through untranslated will now break.
+
+* Added a failonerror to the javac task. If set to false, the build will
continue
+ even if there are compilation errors.
+
+* Added nested format elements to the tstamp task allowing additional time
formats
+ to be defined for arbitrary properties.
+
Fixed bugs:
-----------
1.177 +48 -1 jakarta-ant/docs/index.html
Index: index.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/index.html,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- index.html 2000/12/18 14:26:38 1.176
+++ index.html 2001/01/04 11:13:14 1.177
@@ -29,7 +29,7 @@
</ul>
<p>Version: @VERSION@</p>
-<p>$Id: index.html,v 1.176 2000/12/18 14:26:38 bodewig Exp $</p>
+<p>$Id: index.html,v 1.177 2001/01/04 11:13:14 conor Exp $</p>
<hr>
<h2>Table of Contents</h2>
@@ -3099,6 +3099,13 @@
tracking for compilers that support this (jikes and classic)</td>
<td align="center" valign="top">No</td>
</tr>
+ <tr>
+ <td valign="top">failonerror</td> <td valign="top">
+ If set to false, the build will continue even if there are
compilation errors.
+ Defaults to true.
+ </td>
+ <td align="center" valign="top">No</td>
+ </tr>
</table>
<h3>Parameters specified as nested elements</h3>
@@ -4673,9 +4680,49 @@
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
+ <tr> <td colspan="3"/> No parameters</td>
+ </tr>
+</table>
+
+<h3>Nested Elements</h3>
+The tstamp task supports a format nested element which allows a property to
be
+given the current date and time in a given format. The date/time patterns
are as defined in the Java
+SimpleDateFormat class.
+<p>
+
+<table width="60%" border="1" cellpadding="2" cellspacing="0">
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">property</td>
+ <td valign="top">
+ The property which is to receive the date/time string in the given
pattern
+ </td>
+ <td align="center" valign="top">Yes</td>
+ </tr>
+ <tr>
+ <td valign="top">pattern</td>
+ <td valign="top">The date/time pattern to be used. The values are
defined by the Java
+ SimpleDateFormat class</td>
+ <td align="center" valign="top">Yes</td>
+ </tr>
</table>
+
<h3>Examples</h3>
+<p> Set the standard DSTAMP, TSTAMP and TODAY properties according to the
formats above
<pre> <tstamp/></pre>
+
+<p> As for the above example, set the standard properties and also set the
property
+"TODAY_UK" with the date/time pattern "d MMM yyyy"
+
+<pre> <tstamp>
+ <format property="TODAY_UK" pattern="d MMMM
yyyy">
+ </tstamp>
+</pre>
+
<hr>
<h2><a name="uptodate">Uptodate</a></h2>
<h3>Description</h3>
1.8 +8 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
Index: Tstamp.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tstamp.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Tstamp.java 2001/01/03 14:18:31 1.7
+++ Tstamp.java 2001/01/04 11:13:17 1.8
@@ -123,6 +123,14 @@
public void execute(Project project, Date date)
{
+ if (propertyName == null) {
+ throw new BuildException("property attribute must be
provided", location);
+ }
+
+ if (pattern == null) {
+ throw new BuildException("pattern attribute must be
provided", location);
+ }
+
SimpleDateFormat sdf = new SimpleDateFormat (pattern);
project.setProperty(propertyName, sdf.format(date));
}