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