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?
It should be run as having depends="init" on all targets, ie run twice.
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>!�
Exactly. That's why I proposed to deprecate them.
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. �
Yup.
You can have data outside of methods though, which is why we have data types outside targets. We should keep it that way.
Exactly.
I was improperly saying "deprecating", since global top-level tasks were not enabled in 1.5.
+1 as you say.
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!!!
:-?
-----Original Message----- From: Nicola Ken Barozzi [mailto:[EMAIL PROTECTED] 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.
-- Nicola Ken Barozzi [EMAIL PROTECTED] - verba volant, scripta manent - (discussions get forgotten, just code remains) ---------------------------------------------------------------------
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
