This task is deprecated; it doesn't have direct relevance to the
rest of Antlion. Expect it to be gone by the 1.0 release.
Adds a new target to the build, and if another target exists with the same
name, then replace it along with its dependency list. Compare this to
the Ant 1.6 <import> task, which will allow for targets
to be replaced, but not their dependencies. Also, this new task allows for
a target to be replaced within the same file.
The <replace-target> task can be thought of as identical
to the <target> tag. It must be top-level (not contained
within another target), and can have conditional execution properties and
dependencies.
If the <replace-target> task replaces an existing target,
then the original stays in the project, but is renamed so that only
the new target may invoke it. This original target can be added to the
depends list, as can the parent's depends list be added.
To reference the parent target, use [parent] in the depends
list at the appropriate point; this will indirectly add that parent's
dependencies into the dependency list. To reference that parent's
dependency list, use [parent-depends] in the depends list.
Examples
|
|
|
|
|
<target name="C">
<echo>In target C</echo>
</target>
<target name="B">
<echo>In target B</echo>
</target>
<target name="A" depends="B">
<echo>In target A</echo>
</target>
<replace-target name="A" depends="C">
<echo>This is the real operation</echo>
</subprojects>
|
|
|
|
|
The replace-target will replace the original target "A", and now
target "B" will not be added into the dependency tree, but "C" will.
So, the final execution order will be: C, [replaced]A.
|
|
|
|
<target name="C">
<echo>In target C</echo>
</target>
<target name="B">
<echo>In target B</echo>
</target>
<target name="A" depends="B">
<echo>In target A</echo>
</target>
<replace-target name="A" depends="[parent], C">
<echo>This is the real operation</echo>
</subprojects>
|
|
|
|
|
The replace-target will replace the original target "A", and depend
upon the original to still execute, along with its dependency tree.
So now the final execution order will be: B, [parent]A, C, [replaced]A.
|
|
|
|
<target name="C">
<echo>In target C</echo>
</target>
<target name="B">
<echo>In target B</echo>
</target>
<target name="A" depends="B">
<echo>In target A</echo>
</target>
<replace-target name="A" depends="C, [parent-depends]">
<echo>This is the real operation</echo>
</subprojects>
|
|
|
|
|
The replace-target will replace the original target "A", and depend
upon the original's dependencies to still execute.
So now the final execution order will be: C, B, [replaced]A.
|
|
|