Cari di Apache Ant 
    Apache Ant User Manual
Daftar Isi
(Sebelumnya) DependDiagnostics (Berikutnya)
Apache Ant Tasks

Dependset

DependSet

A task to manage arbitrary dependencies between resources.

Description

The dependset task compares a set of sources with a set of targetfiles. If any of the sources has been modified more recently thanany of the target files, all of the target files are removed.

Sources and target files are specified via nestedResource Collections;sources can be resources of any type, while targets are restricted to filesonly. At least one set of sources and one set of targets is required.

Use a FileSet when you want to use wildcard include or excludepatterns and don't care about missing files. Use a FileList when youwant to consider the non-existence of a file as if it were out ofdate. If there are any non-existing files in any source or targetFileList, all target files will be removed.

DependSet is useful to capture dependencies that are not or cannot bedetermined algorithmically. For example, the <style> task onlycompares the source XML file and XSLT stylesheet against the targetfile to determined whether to restyle the source. Using dependset youcan extend this dependency checking to include a DTD or XSD file aswell as other stylesheets imported by the main stylesheet.

Parameters

Attribute Description Required
verbose Makes the task list all deleted targets files and the reason why they get deleted. No

Parameters Specified as Nested Elements

sources

The <sources> element is aUnion into whicharbitrary resource collections can be nested. Since Apache Ant 1.7

srcfileset

The nested <srcfileset> element specifies a FileSet. All files included inthis fileset will be compared against all files included in all of the<targetfileset> filesets and <targetfilelist>filelists. Multiple <srcfileset> filesets may be specified.

srcfilelist

The nested <srcfilelist> element specifies a FileList. All files included inthis filelist will be compared against all files included in all of the <targetfileset> filesets and <targetfilelist>filelists. Multiple <srcfilelist> filelists may be specified.

targets

The <targets> element is aPath and thus caninclude any filesystem-based resource. Since Ant 1.7

targetfileset

The nested <targetfileset> element specifies a FileSet. All files included inthis fileset will be compared against all files included in all of the<srcfileset> filesets and <sourcefilelist>filelists, and if any are older, they are all deleted.Multiple <targetfileset> filesets may be specified.

targetfilelist

The nested <targetfilelist> element specifies a FileList. All files included inthis filelist will be compared against all files included in all of the<srcfileset> filesets and <sourcefilelist>filelists, and if any are older, they are all deleted.Multiple <targetfilelist> filelists may be specified.

Examples

 <dependset>   <srcfilelist   dir   = "${dtd.dir}"   files = "paper.dtd,common.dtd"/>   <srcfilelist   dir   = "${xsl.dir}"   files = "common.xsl"/>   <srcfilelist   dir   = "${basedir}"   files = "build.xml"/>   <targetfileset   dir  = "${output.dir}"   includes = "**/*.html"/> </dependset>  

In this example derived HTML files in the ${output.dir} directory will be removed if any are out-of-date with respect to:

  1. the DTD of their source XML files
  2. a common DTD (imported by the main DTD)
  3. a subordinate XSLT stylesheet (imported by the main stylesheet), or
  4. the buildfile

If any of the sources in the above example does not exist, alltarget files will also be removed. To ignore missing sources instead,use filesets instead of filelists for the sources.

(Sebelumnya) DependDiagnostics (Berikutnya)