| 1 |
<!DOCTYPE html> |
| 2 |
<!-- |
| 3 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 4 |
contributor license agreements. See the NOTICE file distributed with |
| 5 |
this work for additional information regarding copyright ownership. |
| 6 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 7 |
(the "License"); you may not use this file except in compliance with |
| 8 |
the License. You may obtain a copy of the License at |
| 9 |
|
| 10 |
https://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
|
| 12 |
Unless required by applicable law or agreed to in writing, software |
| 13 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 14 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 |
See the License for the specific language governing permissions and |
| 16 |
limitations under the License. |
| 17 |
--> |
| 18 |
<html lang="en"> |
| 19 |
|
| 20 |
<head> |
| 21 |
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css"> |
| 22 |
<title>DependSet Task</title> |
| 23 |
</head> |
| 24 |
|
| 25 |
<body> |
| 26 |
|
| 27 |
<h2>DependSet</h2> |
| 28 |
|
| 29 |
A task to manage arbitrary dependencies between resources. |
| 30 |
|
| 31 |
<h3>Description</h3> |
| 32 |
|
| 33 |
<p>The <code>dependset</code> task compares a set of sources with a set of target files. If any of |
| 34 |
the sources has been modified more recently than any of the target files, all of the target files |
| 35 |
are removed.</p> |
| 36 |
<p>Sources and target files are specified via |
| 37 |
nested <a href="../Types/resources.html#collection">resource collections</a>; sources can be |
| 38 |
resources of any type, while targets are restricted to files only. At least one set of sources and |
| 39 |
one set of targets is required.</p> |
| 40 |
<p>Use a FileSet when you want to use wildcard include or exclude patterns and don't care about |
| 41 |
missing files. Use a FileList when you want to consider the non-existence of a file as if it were |
| 42 |
out of date. If there are any non-existing files in any source or target FileList, all target files |
| 43 |
will be removed.</p> |
| 44 |
<p>DependSet is useful to capture dependencies that are not or cannot be determined algorithmically. |
| 45 |
For example, the <code><style></code> task only compares the source XML file and XSLT |
| 46 |
stylesheet against the target file to determined whether to restyle the source. |
| 47 |
Using <code>dependset</code> you can extend this dependency checking to include a DTD or XSD file as |
| 48 |
well as other stylesheets imported by the main stylesheet.</p> |
| 49 |
|
| 50 |
<h3>Parameters</h3> |
| 51 |
|
| 52 |
<table class="attr"> |
| 53 |
<tr> |
| 54 |
<th scope="col">Attribute</th> |
| 55 |
<th scope="col">Description</th> |
| 56 |
<th scope="col">Required</th> |
| 57 |
</tr> |
| 58 |
<tr> |
| 59 |
<td>verbose</td> |
| 60 |
<td>Makes the task list all deleted targets files and the reason why they get deleted.</td> |
| 61 |
<td>No</td> |
| 62 |
</tr> |
| 63 |
</table> |
| 64 |
|
| 65 |
<h3>Parameters specified as nested elements</h3> |
| 66 |
|
| 67 |
<h4>sources</h4> |
| 68 |
|
| 69 |
<p>The <code><sources></code> element is a <a href="../Types/resources.html#union">Union</a> |
| 70 |
into which arbitrary resource collections can be nested. <em>Since Apache Ant 1.7</em> |
| 71 |
</p> |
| 72 |
|
| 73 |
<h4>srcfileset</h4> |
| 74 |
|
| 75 |
<p>The nested <code><srcfileset></code> element specifies |
| 76 |
a <a href="../Types/fileset.html">FileSet</a>. All files included in this fileset will be compared |
| 77 |
against all files included in all of the <code><targetfileset></code> filesets |
| 78 |
and <code><targetfilelist></code> filelists. Multiple <code><srcfileset></code> |
| 79 |
filesets may be specified.</p> |
| 80 |
|
| 81 |
<h4>srcfilelist</h4> |
| 82 |
|
| 83 |
<p>The nested <code><srcfilelist></code> element specifies |
| 84 |
a <a href="../Types/filelist.html">FileList</a>. All files included in this filelist will be |
| 85 |
compared against all files included in all of the <code><targetfileset></code> filesets |
| 86 |
and <code><targetfilelist></code> filelists. Multiple <code><srcfilelist></code> |
| 87 |
filelists may be specified.</p> |
| 88 |
|
| 89 |
<h4>targets</h4> |
| 90 |
|
| 91 |
<p><em>Since Ant 1.7</em></p> |
| 92 |
|
| 93 |
<p>The <code><targets></code> element is a <a href="../using.html#path">Path</a> and thus can |
| 94 |
include any filesystem-based resource.</p> |
| 95 |
|
| 96 |
<h4>targetfileset</h4> |
| 97 |
|
| 98 |
<p>The nested <code><targetfileset></code> element specifies |
| 99 |
a <a href="../Types/fileset.html">FileSet</a>. All files included in this fileset will be compared |
| 100 |
against all files included in all of the <code><srcfileset></code> filesets |
| 101 |
and <code><sourcefilelist></code> filelists, and if any are older, they are all deleted. |
| 102 |
Multiple <code><targetfileset></code> filesets may be specified.</p> |
| 103 |
|
| 104 |
<h4>targetfilelist</h4> |
| 105 |
|
| 106 |
<p>The nested <code><targetfilelist></code> element specifies |
| 107 |
a <a href="../Types/filelist.html">FileList</a>. All files included in this filelist will be |
| 108 |
compared against all files included in all of the <code><srcfileset></code> filesets |
| 109 |
and <code><sourcefilelist></code> filelists, and if any are older, they are all deleted. |
| 110 |
Multiple <code><targetfilelist></code> filelists may be specified.</p> |
| 111 |
|
| 112 |
<h3>Examples</h3> |
| 113 |
|
| 114 |
<p>Remove derived HTML files in the ${output.dir} directory if they are out-of-date with respect |
| 115 |
to:</p> |
| 116 |
<ol> |
| 117 |
<li>the DTD of their source XML files</li> |
| 118 |
<li>a common DTD (imported by the main DTD)</li> |
| 119 |
<li>a subordinate XSLT stylesheet (imported by the main stylesheet), or</li> |
| 120 |
<li>the buildfile</li> |
| 121 |
</ol> |
| 122 |
<pre> |
| 123 |
<dependset> |
| 124 |
<srcfilelist |
| 125 |
dir = "${dtd.dir}" |
| 126 |
files = "paper.dtd,common.dtd"/> |
| 127 |
<srcfilelist |
| 128 |
dir = "${xsl.dir}" |
| 129 |
files = "common.xsl"/> |
| 130 |
<srcfilelist |
| 131 |
dir = "${basedir}" |
| 132 |
files = "build.xml"/> |
| 133 |
<targetfileset |
| 134 |
dir = "${output.dir}" |
| 135 |
includes = "**/*.html"/> |
| 136 |
</dependset></pre> |
| 137 |
|
| 138 |
<p>If any of the sources in the above example does not exist, all target files will also be |
| 139 |
removed. To ignore missing sources instead, use filesets instead of filelists for the sources.</p> |
| 140 |
|
| 141 |
</body> |
| 142 |
</html> |