ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject <init>/<finally> and top-level tasks (was RE: Problems with <impo rt>)
Date Sat, 20 Jul 2002 19:21:38 GMT
OK, then. I can agree with that.

Question #1:
How many times do <init> and <finally> run when I do:

ant -builldfile antx build doSomething

If you had build and doSomething both depend on an init target, init would
be run twice. With a special <init> element, how many times does it run?

Question #2:
How does <init> relates to top-level elements like
<property>/<path>/taskdef/...?
Does it run before? after?
having top-level tasks allowed gives you an implicit <init>!
Personnally, I think having an explicit <init> that contains tasks is better
that having top-level tasks. Has St├ęphane B. wrote, you can't wrote code
outside methods in Java, so why allow tasks outside of targets. You can have
data outside of methods though, which is why we have data types outside
targets. We should keep it that way.

Question #3:
Why is it that running:

ant -builldfile antx build doSomething

runs init twice (both targets depends on it), but properties set by the
first target are visible in the second target. It looks like each target is
executed in its own Project, but the fact that the second sees properties
set by the first contradicts that!!!

--DD

-----Original Message-----
From: Nicola Ken Barozzi [mailto:nicolaken@apache.org]
Sent: Saturday, July 20, 2002 11:42 AM
To: Ant Developers List
Subject: Re: Problems with <import>

This is exactly why we should use special tags for them.

<project name="antx"
         default="build">

   <init><!-- no attributes allowed, ie no depends, no name, etc -->
     ...
   </init>

   <target name="build">
     ...
   </target>

   <target name="doSomething">
     ...
   </target>

   <finally><!-- no attributes allowed, ie no depends, no name, etc -->
     ...
   </finally>

</project>

Init and Finally are not targets, they are just sequences of tasks.
Targets have dependencies, can be invoked by name.
This is why I favor using new tags, to make the semantics more evident 
and clean.

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