Description
Sets a property if a target file or set of target files is more up-to-date
than a source file or set of source files. A single source file is specified
using the srcfile attribute. A set of source files is specified
using the nested <srcfiles>
elements. These are FileSets,
whereas multiple target files are specified using a nested
<mapper> element.
By default, the value of the property is set to true if
the timestamp of the target file(s) is more recent than the timestamp of
the corresponding source file(s). You can set the value to something other
than the default by specifying the value attribute.
If a <srcfiles> element is used, without also specifying
a <mapper> element, the default behavior is to use a
merge mapper, with the
to attribute set to the value of the
targetfile attribute.
Normally, this task is used to set properties that are useful to avoid
target execution depending on the relative age of the specified files.
Parameters
Attribute |
Description |
Required |
property |
The name of the property to set. |
Yes |
value |
The value to set the property to. |
No; defaults to true . |
srcfile |
The file to check against the target file(s). |
Yes, unless a nested
<srcfiles> element is present. |
targetfile |
The file for which we want to determine the status. |
Yes, unless a nested
<mapper> element is present. |
Parameters specified as nested elements
The nested <srcfiles> element allows you to specify a
set of files to check against the target file(s).
Note: You can specify either the srcfile
attribute or nested <srcfiles> elements, but not both.
The nested <mapper> element allows you to specify
a set of target files to check for being up-to-date with respect to a
set of source files.
Examples
</uptodate>
This can be written as:
</uptodate>
as well.
<target> tag's unless attribute to
conditionally run that target. For example, running the following target:
...
</target>
will first run the chkXmlBuild target, which contains
the <uptodate> task that determines whether
the unless attribute is then checked for being set/not set.
If it did get set (ie., the jar file is up-to-date),
The following example shows a single source file being checked
against a single target file:
<uptodate property="isUpToDate"
srcfile="/usr/local/bin/testit"
targetfile="${build}/.flagfile"/>
sets the property isUpToDate to true
if /usr/local/bin/testit is newer than
${build}/.flagfile .
Copyright © 2000-2002 Apache Software Foundation.
All rights Reserved.
|