|
|
@@ -52,6 +52,8 @@ |
|
|
|
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> |
|
|
|
|
|
|
|
<blockquote><pre><b>Call-Graph:</b> A --> B --> C --> D</pre></blockquote> |
|
|
|
|
|
|
|
<p>In a chain of dependencies stretching back from a given target |
|
|
|
such as D above, each target gets executed only once, even when |
|
|
@@ -109,6 +111,8 @@ |
|
|
|
</target> |
|
|
|
</pre></blockquote> |
|
|
|
|
|
|
|
<blockquote><pre><b>Call-Graph:</b> myTarget.check --> maybe(myTarget)</pre></blockquote> |
|
|
|
|
|
|
|
<p>If no <code>if</code> and no <code>unless</code> attribute is |
|
|
|
present, the target will always be executed.</p> |
|
|
|
|
|
|
@@ -131,8 +135,25 @@ |
|
|
|
so-called <i>initialization</i> 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>"init"</code>.</p> |
|
|
|
initialization targets have the name <code>"init"</code>.</p> |
|
|
|
<blockquote><pre> |
|
|
|
<project> |
|
|
|
<target name="init"> |
|
|
|
<tstamp/> |
|
|
|
</target> |
|
|
|
<target name="otherTarget" depends="init"> |
|
|
|
... |
|
|
|
</target> |
|
|
|
</project> |
|
|
|
</pre></blockquote> |
|
|
|
|
|
|
|
<p>Especially if you only have a few tasks you also could place these |
|
|
|
tasks direclty under the project tag (since Ant 1.6.0):</p> |
|
|
|
<blockquote><pre> |
|
|
|
<project> |
|
|
|
<tstamp/> |
|
|
|
</project> |
|
|
|
</pre></blockquote> |
|
|
|
|
|
|
|
<p>If the depends attribute and the if/unless attribute are set, the |
|
|
|
depends attribute is executed first.</p> |
|
|
@@ -242,6 +263,9 @@ |
|
|
|
</target> |
|
|
|
</pre></blockquote> |
|
|
|
|
|
|
|
<blockquote><pre><b>Call-Graph:</b> create-directory-layout --> 'empty slot' --> compile</pre></blockquote> |
|
|
|
|
|
|
|
|
|
|
|
<p>And you need to generate some source before compilation, then in |
|
|
|
your main build file you may use something like</p> |
|
|
|
<blockquote><pre> |
|
|
@@ -251,6 +275,9 @@ |
|
|
|
</target> |
|
|
|
</pre></blockquote> |
|
|
|
|
|
|
|
<blockquote><pre><b>Call-Graph:</b> create-directory-layout --> generate-sources --> compile</pre></blockquote> |
|
|
|
|
|
|
|
|
|
|
|
<p>This will ensure that the <em>generate-sources</em> target is |
|
|
|
executed before the <em>compile</em> target.</p> |
|
|
|
|
|
|
|