/usr/share/doc/libantelope-java/manual/bk03ch09.html is in libantelope-java-doc 3.5.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 9. Variable Task</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch08.html" title="Chapter 8. Unset Task"><link rel="next" href="bk03ch10.html" title="Chapter 10. Stopwatch"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Variable Task</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch08.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch10.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="Variable"></a>Chapter 9. Variable Task</h1></div></div></div>
@style@
<p>
The Variable task provides a mutable property to Ant and works much like variable assignment in Java. This task is similar to the standard Ant Property task, except that THESE PROPERTIES ARE MUTABLE. While this goes against the standard Ant use of properties, occasionally it is useful to be able to change a property value within the build. <span class="bold"><strong>In general, use of this task is DISCOURAGED, and the standard Ant Property should be used if possible.</strong></span> Having said that, in real life I use this a lot.
</p><p>
To use this task in your build files, include a task definition like this:
</p><p>
</p><pre class="programlisting">
<taskdef name="var" classname="ise.antelope.tasks.Variable"/>
</pre><p>
</p><p>
Variables can be set individually or loaded from a standard properties file. A 'feature' of variables is that they can override properties, but properties cannot override variables. So if an already established property exists, its value can be reassigned by use of this task.
</p><p>
</p><div class="table"><a name="idm1252"></a><p class="title"><b>Table 9.1. Variable Task Attributes</b></p><div class="table-contents"><table class="table" summary="Variable Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>name</td><td>The name of the property to set.</td><td>None</td><td>Yes, unless 'file' is used.</td></tr><tr><td>value</td><td>The value of the property.</td><td>""</td><td>No</td></tr><tr><td>file</td><td>The name of a standard properties file to load variables from.</td><td>None</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
In the following example, the property <code class="computeroutput">x</code> is first set to "6", then evaluated by the <code class="computeroutput">if</code>, and reassigned the value "12". The <code class="computeroutput">echo</code> task will print out 12.
</p><p>
</p><pre class="programlisting">
<var name="x" value="6"/>
<if name="x" value="6">
<var name="x" value="12"/>
</if>
<echo>${x}</echo> <!-- will print 12 -->
</pre><p>
</p><p>
The following shows some more uses of the Variable task. It is especially handy for property appending. Notice a couple of things: the property task can't override a var value, however, if the var value is set to "", then it can as in the case of the format example.
</p><p>
</p><pre class="programlisting">
<var name="x" value="6"/>
<echo>x = ${x}</echo> <!-- print: 6 -->
<var name="x" value="12"/>
<echo>x = ${x}</echo> <!-- print: 12 -->
<var name="x" value="6 + ${x}"/>
<echo>x = ${x}</echo> <!-- print: 6 + 12 -->
<var name="str" value="I "/>
<var name="str" value="${str} am "/>
<var name="str" value="${str} a "/>
<var name="str" value="${str} string."/>
<echo>${str}</echo> <!-- print: I am a string. -->
<var name="x" value="6"/>
<echo>x = ${x}</echo> <!-- print: 6 -->
<property name="x" value="12"/>
<echo>x = ${x}</echo> <!-- print: 6 (property can't override) -->
<var name="x" value="blue"/>
<tstamp>
<format property="x" pattern="EEEE"/>
</tstamp>
<echo>Today is ${x}.</echo> <!-- print: Today is blue. -->
<var name="x" value=""/>
<tstamp>
<format property="x" pattern="EEEE"/>
</tstamp>
<echo>Today is ${x}.</echo> <!-- print: Today is Friday. -->
</pre><p>
</p><p>
The next example shows Variable, If, Assert, and Try working together to make sure e-mail is sent from the right address and that if the mail fails to be sent for any reason, the build will not fail.
</p><p>
</p><pre class="programlisting">
<var name="valid_email" value="false"/>
<if name="email_from" value="buildteam@mycompany.com">
<var name="valid_email" value="true"/>
</if>
<if name="email_from" value="buildsite@mycompany.com">
<var name="valid_email" value="true"/>
</if>
<assert name="valid_email" value="true" failonerror="false">
<try>
<mail from="${email_from}" tolist="${email_to}"
message="New release available"/>
</try>
</assert>
</pre><p>
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch08.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Unset Task </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Stopwatch</td></tr></table></div></body></html>
|