summaryrefslogtreecommitdiff
path: root/manual/targets.html
diff options
context:
space:
mode:
authorGintas Grigelionis <gintas@apache.org>2018-02-28 07:58:59 +0100
committerGintas Grigelionis <gintas@apache.org>2018-02-28 08:00:45 +0100
commit66b52f99e4306fe928aa5e497021cb51cb927e5e (patch)
treec58d724bc70f01dcf464dc4c84832507ca8c4d82 /manual/targets.html
parent3e61185e19eca3ca70afeda3fb31a1a544f2b474 (diff)
downloadant-66b52f99e4306fe928aa5e497021cb51cb927e5e.tar.gz
Use HTML 5(-ish), fix links
Diffstat (limited to 'manual/targets.html')
-rw-r--r--manual/targets.html210
1 files changed, 105 insertions, 105 deletions
diff --git a/manual/targets.html b/manual/targets.html
index 4c1c891c0..cf38a071b 100644
--- a/manual/targets.html
+++ b/manual/targets.html
@@ -33,9 +33,9 @@
example you might have a target for compiling and a
target for creating a distributable. You can only build a
distributable when you have compiled first, so the distribute
- target <i>depends on</i> the compile target.</p>
+ target <em>depends on</em> the compile target.</p>
- <p>Ant tries to execute the targets in the <code>depends</code>
+ <p>Ant tries to execute the targets in the <var>depends</var>
attribute in the order they appear (from left to right). Keep in
mind that it is possible that a target can get executed earlier
when an earlier target depends on it:</p>
@@ -46,12 +46,12 @@
&lt;target name=&quot;D&quot; depends=&quot;C,B,A&quot;/&gt;</pre>
<p>Suppose we want to execute target D. From its
- <code>depends</code> attribute, you might think that first target
+ <var>depends</var> attribute, you might think that first target
C, then B and then A is executed. Wrong! C depends on B, and B
depends on A, so first A is executed, then B, then C, and finally
D.</p>
- <pre><b>Call-Graph:</b> A --> B --> C --> D</pre>
+ <pre><b>Call-Graph:</b> A &rarr; B &rarr; C &rarr; D</pre>
<p>In a chain of dependencies stretching back from a given target
such as D above, each target gets executed only once, even when
@@ -59,7 +59,7 @@
will first result in C being called, which in turn will first call
B, which in turn will first call A. After A, then B, then C have
executed, execution returns to the dependency list of D, which
- will <u>not</u> call B and A, since they were already called in
+ will <strong>not</strong> call B and A, since they were already called in
process of dependency resolution for C and B respectively as
dependencies of D. Had no such dependencies been discovered in
processing C and B, B and A would have been executed after C in
@@ -68,9 +68,9 @@
<p>A target also has the ability to perform its execution if (or
unless) a property has been set. This allows, for example, better
control on the building process depending on the state of the
- system (java version, OS, command-line property defines, etc.).
- To make a target <i>sense</i> this property, you should add
- the <code>if</code> (or <code>unless</code>) attribute with the
+ system (Java version, OS, command-line property defines, etc.).
+ To make a target <em>sense</em> this property, you should add
+ the <var>if</var> (or <var>unless</var>) attribute with the
name of the property that the target should react
to. <strong>Note:</strong> In the most simple case Ant will only
check whether the property has been set, the value doesn't matter,
@@ -83,14 +83,15 @@
<pre>&lt;target name=&quot;build-own-fake-module-A&quot; unless=&quot;module-A-present&quot;/&gt;</pre>
<p>In the first example, if the <code>module-A-present</code>
- property is set (to any value, e.g. <i>false</i>), the target will
+ property is set (to any value, e.g. <q>false</q>), the target will
be run. In the second example, if
the <code>module-A-present</code> property is set (again, to any
value), the target will not be run.</p>
- <p>Only one propertyname can be specified in the if/unless
- clause. If you want to check multiple conditions, you can use a
- dependent target for computing the result for the check:</p>
+ <p>Only one property name can be specified in
+ the <var>if</var>/<var>unless</var> attribute. If you want to
+ check multiple conditions, you can use a dependent target for
+ computing the result for the check:</p>
<pre>
&lt;target name="myTarget" depends="myTarget.check" if="myTarget.run"&gt;
@@ -104,22 +105,21 @@
&lt;available file="bar.txt"/&gt;
&lt;/and&gt;
&lt;/condition&gt;
-&lt/target&gt;
-</pre>
+&lt/target&gt;</pre>
- <pre><b>Call-Graph:</b> myTarget.check --> maybe(myTarget)</pre>
+ <pre><b>Call-Graph:</b> myTarget.check &rarr; maybe(myTarget)</pre>
- <p>If no <code>if</code> and no <code>unless</code> attribute is
+ <p>If no <var>if</var> and no <var>unless</var> attribute is
present, the target will always be executed.</p>
- <p><b>Important</b>: the <code>if</code> and <code>unless</code>
+ <p><strong>Important</strong>: the <var>if</var> and <var>unless</var>
attributes only enable or disable the target to which they are
attached. They do not control whether or not targets that a
conditional target depends upon get executed. In fact, they do
not even get evaluated until the target is about to be executed,
and all its predecessors have already run.
- <p>The optional <code>description</code> attribute can be used to
+ <p>The optional <var>description</var> attribute can be used to
provide a one-line description of this target, which is printed by
the <code>-projecthelp</code> command-line option. Targets without
such a description are deemed internal and will not be listed,
@@ -128,134 +128,136 @@
<p>It is a good practice to place
your <a href="Tasks/tstamp.html">tstamp</a> tasks in a
- so-called <i>initialization</i> target, on which all other targets
+ so-called <em>initialization</em> target, on which all other targets
depend. Make sure that target is always the first one in the
depends list of the other targets. In this manual, most
initialization targets have the name <code>&quot;init&quot;</code>.</p>
<pre>
- &lt;project&gt;
- &lt;target name=&quot;init&quot;&gt;
- &lt;tstamp/&gt;
- &lt;/target&gt;
- &lt;target name=&quot;otherTarget&quot; depends=&quot;init&quot;&gt;
- ...
- &lt;/target&gt;
- &lt;/project&gt;
- </pre>
+&lt;project&gt;
+ &lt;target name=&quot;init&quot;&gt;
+ &lt;tstamp/&gt;
+ &lt;/target&gt;
+ &lt;target name=&quot;otherTarget&quot; depends=&quot;init&quot;&gt;
+ ...
+ &lt;/target&gt;
+&lt;/project&gt;</pre>
<p>Especially if you only have a few tasks you also could place these
- tasks directly under the project tag (since Ant 1.6.0):</p>
- <pre>
- &lt;project&gt;
- &lt;tstamp/&gt;
- &lt;/project&gt;
- </pre>
+ tasks directly under the project tag (<em>since Ant 1.6.0</em>):</p>
+ <pre>
+&lt;project&gt;
+ &lt;tstamp/&gt;
+&lt;/project&gt;</pre>
- <p>If the depends attribute and the if/unless attribute are set, the
- depends attribute is executed first.</p>
+ <p>If the <var>depends</var> attribute and
+ the <var>if</var>/<var>unless</var> attribute are set,
+ the <var>depends</var> attribute is executed first.</p>
<p>A target has the following attributes:</p>
- <table>
+ <table class="attr">
<tr>
- <td valign="top"><b>Attribute</b></td>
- <td valign="top"><b>Description</b></td>
- <td align="center" valign="top"><b>Required</b></td>
+ <th>Attribute</th>
+ <th>Description</th>
+ <th>Required</th>
</tr>
<tr>
- <td valign="top">name</td>
- <td valign="top">the name of the target.</td>
- <td align="center" valign="top">Yes</td>
+ <td>name</td>
+ <td>the name of the target.</td>
+ <td>Yes</td>
</tr>
<tr>
- <td valign="top">depends</td>
- <td valign="top">a comma-separated list of names of targets on
+ <td>depends</td>
+ <td>a comma-separated list of names of targets on
which this target depends.</td>
- <td align="center" valign="top">No</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">if</td>
- <td valign="top">the name of the property that must be set in
+ <td>if</td>
+ <td>the name of the property that must be set in
order for this target to execute,
or <a href="properties.html#if+unless">something evaluating to
- true</a>.</td>
- <td align="center" valign="top">No</td>
+ <q>true</q></a>.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">unless</td>
- <td valign="top">the name of the property that must not be set
+ <td>unless</td>
+ <td>the name of the property that must not be set
in order for this target to execute,
or <a href="properties.html#if+unless">something evaluating to
- false</a>.</td>
- <td align="center" valign="top">No</td>
+ <q>false</q></a>.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">description</td>
- <td valign="top">a short description of this target's function.</td>
- <td align="center" valign="top">No</td>
+ <td>description</td>
+ <td>a short description of this target's function.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">extensionOf</td>
- <td valign="top">Adds the current target to the depends list of
+ <td>extensionOf</td>
+ <td>Adds the current target to the depends list of
the named <a href="#extension-points">extension-point</a>.
- <em>since Ant 1.8.0.</em></td>
- <td align="center" valign="top">No</td>
+ <em>since Ant 1.8.0</em>.</td>
+ <td>No</td>
</tr>
<tr>
- <td valign="top">onMissingExtensionPoint</td>
- <td valign="top">What to do if this target tries to extend a
+ <td>onMissingExtensionPoint</td>
+ <td>What to do if this target tries to extend a
missing
- <a href="#extension-points">extension-point</a>. ("fail",
- "warn", "ignore").
- <em>since Ant 1.8.2.</em></td>
- <td align="center" valign="top">No. Not allowed unless
- <code>extensionOf</code> is present. Defaults to <code>fail</code>.
+ <a href="#extension-points">extension-point</a>. (<q>fail</q>,
+ <q>warn</q>, <q>ignore</q>).
+ <em>since Ant 1.8.2</em>.</td>
+ <td>No; not allowed unless
+ <var>extensionOf</var> is present, defaults to <q>fail</q>.
</td>
</tr>
</table>
<p>A target name can be any alphanumeric string valid in the
- encoding of the XML file. The empty string &quot;&quot; is in this
- set, as is comma &quot;,&quot; and space &quot; &quot;. Please
- avoid using these, as they will not be supported in future Ant
- versions because of all the confusion they cause on command line and IDE. IDE support of
- unusual target names, or any target name containing spaces, varies
- with the IDE.</p>
-
- <p>Targets beginning with a hyphen such
- as <code>&quot;-restart&quot;</code> are valid, and can be used to
- name targets that should not be called directly from the command
- line. <br>
- For Ants main class every option starting with hyphen is an
- option for Ant itself and not a target. For that reason calling these
- target from command line is not possible. On the other hand IDEs usually
- don't use Ants main class as entry point and calling them from the IDE
- is usually possible.</p>
+ encoding of the XML file. The empty string <q></q> is in this set,
+ as is comma <q>,</q> and space <q>&nbsp;</q>. Please avoid using
+ these, as they will not be supported in future Ant versions
+ because of all the confusion they cause on command line and
+ IDE. IDE support of unusual target names, or any target name
+ containing spaces, varies with the IDE.</p>
+
+ <p>Targets beginning with a hyphen such as <q>-restart</q> are
+ valid, and can be used to name targets that should not be called
+ directly from the command line.<br/>
+ For Ant's main class every option starting with hyphen is an
+ option for Ant itself and not a target. For that reason calling
+ these targets from command line is not possible. On the other
+ hand, IDEs usually don't use Ant's main class as entry point and
+ calling them from the IDE is usually possible.</p>
<h1 id="extension-points">Extension-Points</h1>
- <p><em>since Ant 1.8.0.</em></p>
+ <p><em>since Ant 1.8.0</em>.</p>
- <p>Extension-Points are similar to targets in that they have a name and
- a depends list and can be executed from the command line. Just
- like targets they represent a state during the build process.</p>
+ <p>Extension-Points are similar to targets in that they have a name
+ and a <var>depends</var> list and can be executed from the command
+ line. Just like targets they represent a state during the build
+ process.</p>
<p>Unlike targets they don't contain any tasks, their main purpose
is to collect targets that contribute to the desired state in
their depends list.</p>
- <p>Targets can add themselves to an extension-point's depends list via
- their extensionOf attribute. The targets that add themselves will be
- added after the targets of the explicit depends attribute of the
- extension-point, if multiple targets add themselves, their relative
- order is not defined.</p>
+ <p>Targets can add themselves to an
+ extension-point's <var>depends</var> list via
+ their <var>extensionOf</var> attribute. The targets that add
+ themselves will be added after the targets of the
+ explicit <var>depends</var> attribute of the extension-point, if
+ multiple targets add themselves, their relative order is not
+ defined.</p>
<p>The main purpose of an extension-point is to act as an extension
point for build files designed to
be <a href="Tasks/import.html">imported</a>. In the imported
file, an extension-point defines a state that must be reached and
- targets from other build files can join the depends list of said
- extension-point in order to contribute to that state.</p>
+ targets from other build files can join the <var>depends</var>
+ list of said extension-point in order to contribute to that
+ state.</p>
<p>For example your imported build file may need to compile code, it
might look like:</p>
@@ -267,10 +269,9 @@
depends="create-directory-layout"/&gt;
&lt;target name="compile" depends="ready-to-compile"&gt;
...
-&lt;/target&gt;
-</pre>
+&lt;/target&gt;</pre>
- <pre><b>Call-Graph:</b> create-directory-layout --> 'empty slot' --> compile</pre>
+ <pre><b>Call-Graph:</b> create-directory-layout &rarr; 'empty slot' &rarr; compile</pre>
<p>And you need to generate some source before compilation, then in
your main build file you may use something like</p>
@@ -278,17 +279,16 @@
&lt;target name="generate-sources"
extensionOf="ready-to-compile"&gt;
...
-&lt;/target&gt;
-</pre>
+&lt;/target&gt;</pre>
- <pre><b>Call-Graph:</b> create-directory-layout --> generate-sources --> compile</pre>
+ <pre><b>Call-Graph:</b> create-directory-layout &rarr; generate-sources &rarr; compile</pre>
- <p>This will ensure that the <em>generate-sources</em> target is
- executed before the <em>compile</em> target.</p>
+ <p>This will ensure that the <q>generate-sources</q> target is
+ executed before the <q>compile</q> target.</p>
<p>Don't rely on the order of the depends list,
- if <em>generate-sources</em> depends
- on <em>create-directory-layout</em> then it must explicitly depend
+ if <q>generate-sources</q> depends
+ on <q>create-directory-layout</q> then it must explicitly depend
on it via its own depends attribute.</p>
</body>
</html>