2018-01-03 14:43:27 -05:00

326 lines
10 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 &lt;parallel&gt; or &lt;sequential&gt; element. If any of
the target file's dates are earlier than any of the source file's
dates, then the specified &lt;parallel&gt; or &lt;sequential&gt;
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 &quot;true&quot;</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 &quot;false&quot;.
Default is &quot;true&quot;.
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> &lt;outofdate&gt;
&lt;sourcefiles&gt;
&lt;pathelement path="build.xml"/&gt;
&lt;fileset dir="${lib.dir}"/&gt;
&lt;/sourcefiles&gt;
&lt;targetfiles path="${jrun.file}"/&gt;
&lt;sequential&gt;
&lt;mkdir dir=&quot;${build.bin.dir}&quot;/&gt;
&lt;echo file=&quot;${jrun.file}&quot; message=&quot;java -cp ${jrun.path} $*&quot;/&gt;
&lt;chmod file=&quot;${jrun.file}&quot; perm=&quot;ugo+rx&quot;/&gt;
&lt;/sequential&gt;
&lt;/outofdate&gt; </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> &lt;outofdate&gt;
&lt;sourcefiles&gt;
&lt;pathelement path=&quot;${agent.src}/miblist.txt&quot;/&gt;
&lt;fileset dir=&quot;${mib.src}&quot;/&gt;
&lt;/sourcefiles&gt;
&lt;targetfiles&gt;
&lt;pathelement path=&quot;${rep}/MODULE.IDS&quot;/&gt;
&lt;pathelement path=&quot;${gen-agent}/acme_agent_mib.h&quot;/&gt;
&lt;pathelement path=&quot;${gen-agent}/acme_agent_mib.cpp&quot;/&gt;
&lt;/targetfiles&gt;
&lt;sequential&gt;
&lt;shellscript shell=&quot;bash&quot; dir=&quot;${agent.src}&quot;&gt;
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 &gt; $h1
(head -16 $h1; echo &quot;using namespace Agentpp;&quot;;
tail +16 $h1) &gt; ${gen-agent}/acme_agent_mib.h
ag generate ACME-AGENT-MIB c &gt;\
${gen-agent}/acme_agent_mib.cpp
&lt;/shellscript&gt;
&lt;/sequential&gt;
&lt;/outofdate&gt;</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>
&lt;outofdate property="manual.outofdate" outputsourcespath="sources.path"&gt;
&lt;sourcefiles&gt;
&lt;fileset dir="${src.manual}" includes="**/*.xml"/&gt;
&lt;/sourcefiles&gt;
&lt;targetfiles path="${doc.manual}/index.html"/&gt;
&lt;mapper type="glob" dir="${src.manual}" from="*.xml" to="${doc.manual}/*.html"/&gt;
&lt;/outofdate&gt;
</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>
&lt;outofdate property="manual.outofdate"
outputsources="grammer.sources"&gt;
&lt;sourcefiles&gt;
&lt;fileset dir="${src.grammer}" includes="**/*.y"/&gt;
&lt;/sourcefiles&gt;
&lt;mapper type="glob" dir="${src.grammer}" from="*.y" to="${gen.grammer}/*.c"/&gt;
&lt;mapper type="glob" dir="${src.grammer}" from="*.y" to="${gen.grammer}/*.h"/&gt;
&lt;sequential&gt;
&lt;shellscript shell="bash"&gt;
cd ${gen.grammer}
for g in ${grammer.sources}
do
gengrammer $g
done
&lt;/shellscript&gt;
&lt;/sequential&gt;
&lt;/outofdate&gt;
</PRE>
<HR>
<P ALIGN=CENTER>Copyright &copy; 2003 Ant-Contrib Project. All rights
Reserved.</P>
</BODY>
</HTML>