You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jesse Glick <Je...@netbeans.com> on 2000/08/18 16:52:26 UTC

Re: if basedir absolute file name then resolving file names causes duplicate basedirs in resulting string

Kitching Simon wrote:
> I have a set of projects that I need to build, most of which can be build
> with
> just a couple of different build.xml files. So I put these commonly-used
> buildfiles
> in a common directory, then just have something like:
> <ant dir="srcdir1" antfile="${buildfiledir}/buildclasses.xml" />
> <ant dir="srcdir2" antfile="${buildfiledir}/buildclasses.xml" />
> <ant dir="srcdir3" antfile="${buildfiledir}/buildapplet.xml" />
> <ant dir="srcdir4" antfile="${buildfiledir}/buildapplet.xml" />

I see your point, but disagree that this should be the normal behavior.
In your example, I would think that it would be more natural, if a
little cumbersome, to write <property name="basedir"
value="${basedir}/srcdir1"/> inside the Ant tasks, to make it explicit
that your intent is to set the basedir of the subproject differently
depending on how it is called. (Does this in fact work? Probably not at
the moment.) But I feel the default should be that basedir attributes of
subprojects should be taken at face value. Currently there is no way to
honor them; if subprojects have non-"." basedirs, you must know in the
master script what they are, and remember to take that into account.
Also the current behavior is not analogous to the ant commandline syntax
which is uncomfortable.

Can you think of a decent compromise? Perhaps an attribute
basedir="srcdir1" to <ant> to explicitly override the subproject's
basedir, with 'dir' meaning only "directory of the ant script"? Or can
subprojects use variable substitution in their 'basedir' attribute? Or
make the subproject's basedir set according to its wishes relative to
its containing directory, if <ant> has no 'dir' attribute (but then the
behavior is different with dir=".")? Also in your case you could simply
pass in a ${topdir} or similar variable to the subproject, to be used in
all paths, but of course this is less convenient than basedir.

I definitely agree that if the behavior should be left as is, the
documentation should be clearer on how it works as you suggested.

-Jesse

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

Re: if basedir absolute file name then resolving file names causes duplicate basedirs in resulting string

Posted by Barrie Treloar <Ba...@camtech.com.au>.
On Fri, 18 Aug 2000, Jesse Glick wrote:

[del]

> Can you think of a decent compromise? Perhaps an attribute
> basedir="srcdir1" to <ant> to explicitly override the subproject's
> basedir, with 'dir' meaning only "directory of the ant script"? Or can
> subprojects use variable substitution in their 'basedir' attribute? Or
> make the subproject's basedir set according to its wishes relative to
> its containing directory, if <ant> has no 'dir' attribute (but then the
> behavior is different with dir=".")? Also in your case you could simply
> pass in a ${topdir} or similar variable to the subproject, to be used in
> all paths, but of course this is less convenient than basedir.