You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jon seymour <jo...@zeta.org.au> on 2000/02/13 00:38:39 UTC
discussion: build file format
Here are some points for offered for discussion and contemplation...I'd be interested in the
developers' thoughts.
I understand it, the following implicit rules govern the structure of the build file format.
* if a target contains XML elements, then each element:
o is an empty XML element
o specifies a task
o is executed in the order determined by its position within its parent target
Is this always going to be the case? For example: I think it would be neat to if dependencies
could be specified as child elements rather than attributes, as in:
<target name="dist" depends="jar,javadocs">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/lib"/>
...
</target>
might be:
<target name="dist">
<depend target="jar"/>
<depend target="jardocs"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/lib"/>
</target>
Why would you want to do that? For one, if you had a large number of dependencies, it would be far
easier to maintain the build file if each dependency was on a separate line. Of course, you could
write:
<target name="something" depends="
x,
y,
z
">
but that looks a tad ugly. Also, it would allow other attributes to be associated with a
dependency. For example:
<target name="output">
<depend name="input"/>
<depend name="output.c" type="file"/>
<depend name="someheader.h" type="file"/>
<cc source="output.c" object="output.o"/>
</target>
<target name="input">
...
In this case, we have a dependency on another target but also on two external files.
Also, I must confess a bias here: I have a slight aversion to representing 1:n relationships in
XML attributes. Also, if I was going to do it, I'd use ' ' as the separator, not ',' since at
least then I get some API (or XSLT) support for parsing it [ the XML attribute value separator is
' ']
Similarly, if a task has a large number of inputs, it might be easier if they could be described
by multiple child elements of the task reference, for example:
<target name="a.out">
<depend name="input"/>
<depend name="output"/>
<link exe="a.out">
<object name="input.o"/>
<object name="output.o"/>
</link>
</target>
Regards,
jon.