Browse Source

Add a value attribute to <uptodate>

Submitted by:	Tim Dawson <tdawson@wamnet.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268899 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
b16a773dea
3 changed files with 26 additions and 1 deletions
  1. +2
    -0
      WHATSNEW
  2. +5
    -0
      docs/manual/CoreTasks/uptodate.html
  3. +19
    -1
      src/main/org/apache/tools/ant/taskdefs/UpToDate.java

+ 2
- 0
WHATSNEW View File

@@ -12,6 +12,8 @@ Changes that could break older environments:

* <touch> can now work on <fileset>s

* <uptodate> now supports a value attribute

Other changes:
--------------



+ 5
- 0
docs/manual/CoreTasks/uptodate.html View File

@@ -34,6 +34,11 @@ execution depending on the relative age of the specified files.</p>
<td valign="top">the name of the property to set.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">value</td>
<td valign="top">the value to set the property to. Defaults to &quot;true&quot;.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">targetfile</td>
<td valign="top">the file for which we want to determine the status.</td>


+ 19
- 1
src/main/org/apache/tools/ant/taskdefs/UpToDate.java View File

@@ -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);


Loading…
Cancel
Save