ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darrell DeBoer <darr...@apache.org>
Subject Re: Possible bug with <parallel>, <antcall> and depends
Date Thu, 02 May 2002 07:44:37 GMT
Hi Chad.

On Thu, 2 May 2002 17:08, Chad Loder wrote:
> as per statement (1) from the ant docs:
> > >     "A target gets executed only once, even when more than
> > >     one target depends on it (see the previous example)."
>
> I want this to happen even when they are built in parallel.
>
> Currently, if I don't use <parallel>, the mutual dependencies
> of all the <antcall>'s are executed at most once (the desired
> and expected behavior).

I'd be surprised if this were the case. From my understanding and experience, 
<antcall> will re-execute any targets which are dependencies of the 
<antcall>ed target. That's what's meant by:

>          "When a target is invoked by antcall, all of its dependent
>          targets will also be called within the context of any new
>          parameters. For example. if the target "doSomethingElse"
>          depended on the target "init", then the antcall of
>          "doSomethingElse" will call "init" during the call."

Take this build file:
<project name="test" default="main">
    <target name="init">
       <echo message="in init"/>
    </target>

    <target name="test1" depends="init">
      <echo message="in test1"/>
    </target>

    <target name="test2" depends="init">
      <echo message="in test2"/>
    </target>

    <target name="main-antcall">
        <antcall target="test1"/>
        <antcall target="test2"/>
    </target>

    <target name="main-depends" depends="test1, test2"/>
</project>

Executing target "main-antcall" results in:
--------------------------------
main-antcall:

init:
     [echo] in init

test1:
     [echo] in test1

init:
     [echo] in init

test2:
     [echo] in test2
------------------------------------

Executing target "main-depends" results in:
------------------------------------
init:
     [echo] in init

test1:
     [echo] in test1

test2:
     [echo] in test2

main-depends:
-----------------------------------

I hope this makes it clearer. I don't think <parallel> has anything to do with 
the behaviour you're seeing. Maybe this isn't how *you* want <antcall> to 
work, but believe me, that's definitely how it's intended to work.

> >When you call antcall you are calling <ant> on the
> >buildfile; a whole new context of execution.
>
> If that's the explanation for why <parallel> <antcall>'s
> cause mutual dependencies to be executed more than once,
> then why should <parallel> make any difference?

I don't think it does. You'd better check to make sure...

-- 
ciao,
Daz

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message