From b16a773dea13b6248d0cfa53139198232ee500cb Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 29 Mar 2001 10:13:07 +0000 Subject: [PATCH] Add a value attribute to Submitted by: Tim Dawson git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268899 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 ++ docs/manual/CoreTasks/uptodate.html | 5 +++++ .../apache/tools/ant/taskdefs/UpToDate.java | 20 ++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index f6ee4de53..0b044159a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -12,6 +12,8 @@ Changes that could break older environments: * can now work on s +* now supports a value attribute + Other changes: -------------- diff --git a/docs/manual/CoreTasks/uptodate.html b/docs/manual/CoreTasks/uptodate.html index 658cdaffe..de5329206 100644 --- a/docs/manual/CoreTasks/uptodate.html +++ b/docs/manual/CoreTasks/uptodate.html @@ -34,6 +34,11 @@ execution depending on the relative age of the specified files.

the name of the property to set. Yes + + value + the value to set the property to. Defaults to "true". + No + targetfile the file for which we want to determine the status. diff --git a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java index 9574c9abb..a898eff80 100644 --- a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java @@ -74,6 +74,7 @@ import java.util.Vector; public class UpToDate extends MatchingTask { private String _property; + private String _value; private File _targetFile; private Vector sourceFileSets = new Vector(); @@ -89,6 +90,23 @@ public class UpToDate extends MatchingTask { _property = property; } + /** + * The value to set the named property to if the target file is more up to + * date than each of the source files. Defaults to 'true'. + * + * @param value the value to set the property to if Target is up to date + */ + public void setValue(String value) { + _value = value; + } + + /** + * Returns the value, or "true" if a specific value wasn't provided. + */ + private String getValue() { + return ( _value != null ) ? _value : "true"; + } + /** * The file which must be more up to date than each of the source files * if the property is to be set. @@ -145,7 +163,7 @@ public class UpToDate extends MatchingTask { } if (upToDate) { - this.project.setProperty(_property, "true"); + this.project.setProperty(_property, this.getValue()); if (mapperElement == null) { log("File \"" + _targetFile.getAbsolutePath() + "\" is up to date.", Project.MSG_VERBOSE);