From e92741fae973209f511599673bcdedd67d1dd9ac Mon Sep 17 00:00:00 2001
From: Conor MacNeill
Date: Thu, 4 Jan 2001 11:13:17 +0000
Subject: [PATCH] Add some error checking to new TSTAMP format element
Documentation fro tstamp and javac changes
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268397 13f79535-47bb-0310-9956-ffa450edef68
---
WHATSNEW | 10 ++++
docs/index.html | 47 +++++++++++++++++++
.../org/apache/tools/ant/taskdefs/Tstamp.java | 8 ++++
3 files changed, 65 insertions(+)
diff --git a/WHATSNEW b/WHATSNEW
index c74bc9d98..4afe691bb 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -45,6 +45,16 @@ Other changes:
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:
-----------
diff --git a/docs/index.html b/docs/index.html
index 23a1ecce9..c56fa9c31 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -3099,6 +3099,13 @@ inclusion/exclusion of files works, and how to write patterns.
tracking for compilers that support this (jikes and classic)
No |
+
+ failonerror |
+ If set to false, the build will continue even if there are compilation errors.
+ Defaults to true.
+ |
+ No |
+
Parameters specified as nested elements
@@ -4673,9 +4680,49 @@ initialization target.
Description |
Required |
+ | No parameters
+
+
+
+Nested Elements
+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.
+
+
+
+
+ Attribute |
+ Description |
+ Required |
+
+
+ property |
+
+ The property which is to receive the date/time string in the given pattern
+ |
+ Yes |
+
+
+ pattern |
+ The date/time pattern to be used. The values are defined by the Java
+ SimpleDateFormat class |
+ Yes |
+
+
Examples
+ Set the standard DSTAMP, TSTAMP and TODAY properties according to the formats above
<tstamp/>
+
+ As for the above example, set the standard properties and also set the property
+"TODAY_UK" with the date/time pattern "d MMM yyyy"
+
+
<tstamp>
+ <format property="TODAY_UK" pattern="d MMMM yyyy">
+ </tstamp>
+
+
Description
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
index e60a09e6c..ab948509f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
@@ -123,6 +123,14 @@ public class Tstamp extends Task {
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));
}