G.13 Modified

The <modified> selector computes a value for a file, compares that to the value stored in a cache and select the file, if these two values differ.

Because this selector is highly configurable the order in which the selection is done is:

  1. get the absolute path for the file
  2. get the cached value from the configured cache (absolute path as key)
  3. get the new value from the configured algorithm
  4. compare these two values with the configured comparator
  5. update the cache if needed and requested
  6. do the selection according to the comparison result

The comparison, computing of the hashvalue and the store is done by implementation of special interfaces. Therefore they may provide additional parameters.

Table G.12:  Attributes for the <modified> selector

NameDescriptionDefaultRequired
algorithmThe type of algorithm should be used. Acceptable values are (further information see later):
  • hashfile
  • lastmodified
hashfileNo
cacheThe type of cache should be used. Acceptable values are (further information see later):
  • propertyfile
propertyfileNo
comparatorThe type of comparator should be used. Acceptable values are:
  • equal
equalNo
algorithmclassClassname of custom algorithm implementation. Lower priority than algorithm.n/aNo
cacheclassClassname of custom cache implementation. Lower priority than cache.n/aNo
comparatorclassClassname of custom comparator implementation. Lower priority than comparator.n/aNo
updateShould the cache be updated when values differ? (boolean)trueNo
seldirsShould directories be selected? (boolean)trueNo
delayupdateIf set to "true", the storage of the cache will be delayed until the next finished BuildEvent; task finished, target finished or build finished, whichever comes first. This is provided for increased performance. If set to "false", the storage of the cache will happen with each change. This attribute depends upon the update attribute. (boolean)trueNo

G.13.1 Parameters specified as nested elements

All attributes of a <modified> selector an be set with nested <param/> tags. Additional values can be set with <param/> tags according to the rules below.

Table G.13: algorithm

NameDescriptionDefaultRequired
hashfileThis Algorithm supports the following attribute:
  • algorithm.algorithm (optional): Name of the hashfile algorithm (e.g. "MD5" or "SHA"); default is "MD5"
n/aNo
lastmodifiedUses the lastModified property of a file. No additional configuration is required.n/aNo

G.13.2 Examples

Here are some examples of how to use the Modified Selector:

<copy todir="dest">
    <fileset dir="src">
        <modified/>
    </fileset>
</copy>

This will copy all files from src to dest which content has changed. Using an updating PropertyfileCache with cache.properties and MD5-FilehashAlgorithm.

<copy todir="dest">
    <fileset dir="src">
        <modified update="true"
              seldirs="true"
              cache="propertyfile"
              algorithm="digest"
              comparator="equal">
            <param name="cache.cachefile"     value="cache.properties"/>
            <param name="algorithm.algorithm" value="md5"/>
        </modified>
    </fileset>
</copy>