Hi Stefan,
-------- Original-Nachricht --------
> Von: Stefan Bodewig <[email protected]>
> On 2009-10-12, Christian Möller <[email protected]> wrote:
> > <target name="init">
> > <echo>Hello from target 'init'</echo>
> > <appendExecutionOf target="extra-pre-test" toTarget="pre-test" />
> > <appendExecutionOf target="extra-post-test" toTarget="post-test" />
> > </target>
>
> > <target name="test" depends="init">
> > <antcall target="pre-test"/>
> > <echo>Hello from target 'test'</echo>
> > <antcall target="post-test"/>
> > </target>
>
> > This is purposing the follwing: Adding execution of additional targets
> > (here "extra-pre-test" and "extra-post-test") to some other targets
> > (here "pre-test" and "post-test", respectively) depending on
> > environmental properties (not shown here for simplicity).
>
> > But unfortunalety this does not work as expected:
>
> Your macro (which looks fine, that's why I snipped it) adds a new task
> to a target in the currently executing Project instance. In your test
> you try to validate that it worked via antcall which creates a new
> Project instance and re-parses the build file for that new instance -
> your macro has never been executed for this instance and so the tasks
> have never been added there.
Tank you very much, I got it myself - by a strange coincidence at roughly the
same time as you wrote your helpful answer :-). So your reply confirms my own
conclusions.
In the light of your explanation <antcall> does not only "Call another target
within the same buildfile optionally specifying some properties [...]" as
stated in the docs. Maybe it's worth emphasizing in the docs that a *new
project* is instantiated, isn't it?
> If you try
>
> <target name="test" depends="init, pre-test"/>
>
> you should see you extra-pre-test. Alternatively make pre-test and
> post-test depend on init so the tasks get added in their Project
> instance even in the presence of antcall.
My solution now looks something like this:
[...]
<target name="init">
<echo>Target 'init'</echo>
<appendExecutionOf target="extra-pre-main" toTarget="pre-main" />
<appendExecutionOf target="extra-post-main" toTarget="post-main" />
</target>
<target name="extra-pre-main">
<echo>Target 'extra-pre-main'</echo>
</target>
<target name="extra-post-main">
<echo>Target 'extra-post-main'</echo>
</target>
<target name="pre-main">
<echo>Target 'pre-main'</echo>
</target>
<target name="post-main">
<echo>Target 'post-main'</echo>
</target>
<target name="do-main">
<echo>Target 'main'</echo>
</target>
<target name="main" depends="init, pre-main, do-main, post-main"/>
Thanks again.
Christian
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]