ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <step...@einsurance.de>
Subject Re: article: combining make and ant
Date Thu, 21 Mar 2002 14:25:47 GMT
On Thursday 21 March 2002 15:20 pm, Conor MacNeill wrote:
> stephan beal wrote:
> > Another example of this is the fact that ant will (annoyingly) run a
> > target multiple times if it's in multiple depends="..." lines. Make does
> > not do this - it recognizes that a given dependency was already run and
> > doesn't run it again. My 'init' target gets run multiple times (hosing my
> > output log, since <record action="start"/> gets called multiple times)
> > unless i do something silly like this:
> >
> > <target name="init" unless="init.alreadydone">
> > 	<property name='init.alreadydone' value='true'/>
> > ...
> > </target>
>
> You are either use (overusing) antcall or passing in many targets on the
> command line. Ant will "run" a target only once unless this is true.

i'm using antcall, yes, but i don't think i'm over-using it. i have the 
following setup:

<target name="main" depends="init">
        <antcall target="cvsupdate"/>
        <antcall target="dbclasses"/>
        <antcall target="slabdbclasses"/>
        <antcall target="compile"/>
        <antcall target="maillog"/>
</target>

Now, for example, cvsupdate and dbclasses both have depends="init" (because 
it is possible that i run them standalone, and 'init' needs to set up some 
properties and kick off the logger). In fact, all of those targets except 
maillog depends on init.

When i call 'ant main', init is getting called multiple times:

build@poe:~/cvs/int > ant main -buildfile build.stephan.xml
Buildfile: build.stephan.xml

init:
     [echo] Recording build messages to ant.log
     [echo] Starting build: /home/build/cvs/int
     [echo] Start time: 2002.03.21 15:21:12
     [echo] Builder = stephan@einsurance.de

main:

init:
     [echo] Recording build messages to ant.log
     [echo] Starting build: /home/build/cvs/int
     [echo] Start time: 2002.03.21 15:21:12
     [echo] Builder = stephan@einsurance.de

cvsupdate:

init:
     [echo] Recording build messages to ant.log
     [echo] Starting build: /home/build/cvs/int
     [echo] Start time: 2002.03.21 15:21:13
     [echo] Builder = stephan@einsurance.de

dbclasses:

init:
     [echo] Recording build messages to ant.log
     [echo] Starting build: /home/build/cvs/int
     [echo] Start time: 2002.03.21 15:21:13
     [echo] Builder = stephan@einsurance.de

slabdbclasses:

compile:
...


Evil, evil behaviour, IMO. i get around this by using this:
    <target name="init" unless="init.alreadydone">
        <property name='init.alreadydone' value='true'/>

Now my build does this:
build@poe:~/cvs/int > ant main -buildfile build.stephan.xml
Buildfile: build.stephan.xml

init:
     [echo] Recording build messages to ant.log
     [echo] Starting build: /home/build/cvs/int
     [echo] Start time: 2002.03.21 15:24:54
     [echo] Builder = stephan@einsurance.de

main:

init:

cvsupdate:

init:

dbclasses:

init:

slabdbclasses:

compile:



-- 
----- stephan
Generic Universal Computer Guy
stephan@einsurance.de - http://www.einsurance.de
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

--
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