You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@bost.de> on 2000/09/04 14:46:15 UTC

Where to place stand alone data types like ?

If you look at Ant's own build.xml, you can see that the PatternSet
with the id "chmod.patterns" is defined in a <chmod> task in target
main and referenced twice later on. This makes the <chmod> in main
special.

I feel, it would be much more natural to define the patternset
somewhere outside the task and use a <patternsetref> in the first
<chmod> as well. The same holds true for FileSets or PATH like
structures that get used more than once.

I've added infrastructure needed to have <path>, <patternset> and
<fileset> elements in the build.xml with my last patch. Only
ProjectHelper is not aware of this yet.

Given that the reference mechanism in Ant is a global one (and
antstructure claims it would sit on top of the XML ID attribute type -
which means the id must be unique 8^), I'd say make <path> and friends
a sibling of <target> and only allow them to be placed there and not
inside of <target>s. This would avoid the confusion of <property> as
well.

What do you think?

Stefan

Re: Where to place stand alone data types like ?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "JG" == Jesse Glick <Je...@netbeans.com> writes:

 JG> But most of the time you want anonymous <path> and so on, I
 JG> think, and you do not need an ID for it, nor do you want to place
 JG> it far away from the context of the task it is intended
 JG> for... 

Of course, I haven't been clear enough I guess.

I want <path> as a global structure to be used in <classpathref> and
friends - this one should be a sibbling of target. I didn't want to
say you'd have to put *everything* into these global structures.

What I want is: <fileset> can be a child of <execon> (for example) and
a child of <project> but _not_ a child of <target>.

Stefan

Re: Where to place stand alone data types like ?

Posted by Jesse Glick <Je...@netbeans.com>.
Stefan Bodewig wrote:
> Given that the reference mechanism in Ant is a global one (and
> antstructure claims it would sit on top of the XML ID attribute type -
> which means the id must be unique 8^), I'd say make <path> and friends
> a sibling of <target> and only allow them to be placed there and not
> inside of <target>s. This would avoid the confusion of <property> as
> well.

But most of the time you want anonymous <path> and so on, I think, and
you do not need an ID for it, nor do you want to place it far away from
the context of the task it is intended for... maybe: if <path> or a
similar data element occurs inside a task *and* has an ID set, issue a
mild warning that it is better style to put it at top level. Issue the
same warning for <property> inside targets.

-Jesse

-- 
Jesse Glick   <ma...@netbeans.com>
NetBeans, Open APIs  <http://www.netbeans.org/>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR