1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Ant-contrib Tasks: OutOfDate</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 644 (Linux)">
<META NAME="CREATED" CONTENT="20030314;12023500">
<META NAME="CHANGED" CONTENT="20030319;15211400">
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H1>OutOfDate</H1>
<P>Task definition for the <CODE>outofdate</CODE> task. This is an
extension of uptodate which allows multible targets and contains an
embedded <parallel> or <sequential> element. If any of
the target file's dates are earlier than any of the source file's
dates, then the specified <parallel> or <sequential>
block is executed. The task may also contain mappers to map source
files to corresponding target files.
</P>
<H2>Parameters</H2>
<TABLE WIDTH=100% BORDER=1 CELLPADDING=2 CELLSPACING=0>
<COL WIDTH=0>
<COL WIDTH=0>
<COL WIDTH=0>
<TR>
<TH>
<P>Attribute</P>
</TH>
<TH>
<P>Description</P>
</TH>
<TH>
<P>Required</P>
</TH>
</TR>
<TR VALIGN=TOP>
<TD>
<P>property</P>
</TD>
<TD>
<P>The name of the property to set to the contents of the <CODE>value</CODE>
parameter if any of the target files are out of date</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>value</P>
</TD>
<TD>
<P>The value to set the property specified by the parameter
<CODE>property</CODE> to, if any of the target files are out of
date</P>
</TD>
<TD>
<P ALIGN=LEFT>No, defaults to "true"</P>
</TD>
</TR>
<tr>
<td valign="top">force</td>
<td valign="top">
Force outofdate ("true"/"false"). Default is "false".
</td>
<td valign="top">No</td>
</tr>
<tr>
<td valign="top">verbose</td>
<td valign="top">
Set vebose logging level for this task ("true"/"false").
Default is "false".
</td>
<td valign="top">No</td>
</tr>
<TR VALIGN=TOP>
<TD>
<P>outputsources</P>
</TD>
<TD>
<P>The name of a property to set containing the sources that are
newer that their corresponding targets.</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>outputtargets</P>
</TD>
<TD>
<P>The name of a property to set containing the targets that are
outofDate with respect to their corresponding sources.</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>alltargets</P>
</TD>
<TD>
<P>The name of a property to set containing all the targets. This
is usefull for debugging mapper nested elements.</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>separator</P>
</TD>
<TD>
<P>The separator used to separate the files in the properties
above. If a filename contains the separator, double quotes will be
placed aroudnd the filename.</P>
</TD>
<TD>
<P ALIGN=LEFT>No, defaults to “ “</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>outputsourcespath</P>
</TD>
<TD>
<P>The id of a path to create containing the source files that are
outofdate.</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>outputtargetspath</P>
</TD>
<TD>
<P>The id of a path to create containing the target files that
need to be updated.</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>alltargetspath</P>
</TD>
<TD>
<P>The id of a path to create containing all the target files.
</P>
</TD>
<TD>
<P ALIGN=LEFT>No</P>
</TD>
</TR>
</TABLE>
<H2>Attributes specified as nested elements</H2>
<P><B>sourcefiles</B> - The list of files which are source files.
This element is required.
<BR><BR><B>targetfiles</B> - The list of
files which are target files.
</P>
<P>Both of these nested elements are <A HREF="http://ant.apache.org/manual/using.html#path">Path</A>
elements which are are used to select sets or lists of files or
directories</P>
<p>The <i>sourcefiles</i> may contain no files. In this case, outofdate will
check the existance of the <i>targetfiles</i>.</p>
<P><B>mapper –</B> This is used to map source files to target
files.</P>
As well as the regular attributes for mapper, there is a extra attribute to specify
the relative directory of the sources.<p>
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">dir</td>
<td valign="top">
The directory to the sources are relative to for the mapper.
Default is ${base.dir}.
</td>
<td valign="top">No</td>
</tr>
</table>
<P>There may be a number of mapper nested elements.
<P><B>deletetargets –</B> This is used to delete targets if the
corresponding sources are outofdate.
</P>
<table cellspacing="0" cellpadding="2" border="1">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">all</td>
<td valign="top">
Whether to delete all the targets ("true"/"false"). Defaults to
"false".
</td>
<td valign="top">No</td>
</tr>
<tr>
<td valign="top">quiet</td>
<td valign="top">
Do not display diagnostic messages when deleting targets
("true"/ "false"). Defaults to false.
When set to "true", if a file or directory cannot be deleted,
no error is reported. This setting emulates the -f option to
the Unix rm command. Default is "false".
Setting this to "true" implies setting failonerror to "false"
</td>
<td valign="top">No</td>
</tr>
<tr>
<td valign="top">failonerror</td>
<td valign="top">
Controls whether an error (such as a failure to delete a file)
stops the build or is merely reported to the screen.
Only relevant if quiet is "false".
Default is "true".
Controls whether a failure to delete a target stops
the build or is merely reported to the screen.
</td>
<td valign="top">No</td>
</tr>
</table>
</P>
<H2>Examples</H2>
<P>The following example creates the file ${jrun.file} if is older
that build.xml, or any file in ${lib.dir}.</P>
<PRE> <outofdate>
<sourcefiles>
<pathelement path="build.xml"/>
<fileset dir="${lib.dir}"/>
</sourcefiles>
<targetfiles path="${jrun.file}"/>
<sequential>
<mkdir dir="${build.bin.dir}"/>
<echo file="${jrun.file}" message="java -cp ${jrun.path} $*"/>
<chmod file="${jrun.file}" perm="ugo+rx"/>
</sequential>
</outofdate> </PRE><P>
The following example check the generated files, MODULE.IDS,
acme_agent_mib.h, acme_agent_mib.cpp are older that miblist.txt, or
any file in ${mib.src}, and if so an embedded shellScript is invoked
to update the files.</P>
<PRE> <outofdate>
<sourcefiles>
<pathelement path="${agent.src}/miblist.txt"/>
<fileset dir="${mib.src}"/>
</sourcefiles>
<targetfiles>
<pathelement path="${rep}/MODULE.IDS"/>
<pathelement path="${gen-agent}/acme_agent_mib.h"/>
<pathelement path="${gen-agent}/acme_agent_mib.cpp"/>
</targetfiles>
<sequential>
<shellscript shell="bash" dir="${agent.src}">
classname=com.agentpp.agentgen.AgentGenConsole
h1=${gen-agent}/acme_agent_mib.x
ag() {
java -cp ${lib.dir}/agentgen.jar $classname ${rep} $@
}
ag initialize
ag load miblist.txt
ag generate ACME-AGENT-MIB h > $h1
(head -16 $h1; echo "using namespace Agentpp;";
tail +16 $h1) > ${gen-agent}/acme_agent_mib.h
ag generate ACME-AGENT-MIB c >\
${gen-agent}/acme_agent_mib.cpp
</shellscript>
</sequential>
</outofdate></PRE><P>
The following example sets the project <I>manual.outofdate</I> if any
of the xml files are newer than index.html, or if any of the xml
files are newer than their corresponding .html file. A path
identified by <I>sources.path</I>, is created which contains the
sources that fullfilled these conditions.</P>
<PRE>
<outofdate property="manual.outofdate" outputsourcespath="sources.path">
<sourcefiles>
<fileset dir="${src.manual}" includes="**/*.xml"/>
</sourcefiles>
<targetfiles path="${doc.manual}/index.html"/>
<mapper type="glob" dir="${src.manual}" from="*.xml" to="${doc.manual}/*.html"/>
</outofdate>
</PRE>
<P>
The following assumes that there is a program called <I>gengrammer</I>
that takes a grammer file as an input and generates a .h and a .c
file in the current directory.</P>
<PRE>
<outofdate property="manual.outofdate"
outputsources="grammer.sources">
<sourcefiles>
<fileset dir="${src.grammer}" includes="**/*.y"/>
</sourcefiles>
<mapper type="glob" dir="${src.grammer}" from="*.y" to="${gen.grammer}/*.c"/>
<mapper type="glob" dir="${src.grammer}" from="*.y" to="${gen.grammer}/*.h"/>
<sequential>
<shellscript shell="bash">
cd ${gen.grammer}
for g in ${grammer.sources}
do
gengrammer $g
done
</shellscript>
</sequential>
</outofdate>
</PRE>
<HR>
<P ALIGN=CENTER>Copyright © 2003 Ant-Contrib Project. All rights
Reserved.</P>
</BODY>
</HTML>
|