next up previous contents index
Next: Waitfor Up: Uptodate Previous: Parameters specified as nested   Contents   Index

Examples

  <uptodate property="xmlBuild.notRequired"
   targetfile="${deploy}\xmlClasses.jar" >
    <srcfiles dir= "${src}/xml" includes="**/*.dtd"/>
  </uptodate>
sets the property xmlBuild.notRequired to true if the ${deploy}/xmlClasses.jar file is more up-to-date than any of the DTD files in the ${src}/xml directory.

This can be written as:

  <uptodate property="xmlBuild.notRequired">
    <srcfiles dir= "${src}/xml" includes="**/*.dtd"/>
    <mapper type="merge" to="${deploy}\xmlClasses.jar"/>
  </uptodate>
as well. The xmlBuild.notRequired property can then be used in a <target> tag's unless attribute to conditionally run that target. For example, running the following target:
<target name="xmlBuild" depends="chkXmlBuild" unless="xmlBuild.notRequired">
  ...
</target>
will first run the chkXmlBuild target, which contains the <uptodate> task that determines whether xmlBuild.notRequired gets set. The property named in the unless attribute is then checked for being set/not set. If it did get set (ie., the jar file is up-to-date), then the xmlBuild target won't be run.

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.



Andrew Marlow 2003-07-08