ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Cepek" <mce...@smsi.com>
Subject RE: fail-safe O/S-dependent operations idiom?
Date Fri, 19 Jul 2002 15:14:53 GMT
Dominique Devienne <DDevienne@lgc.com> wrote:

> She's not being picky, but letting you know it's better to use
>   <property name="ant_loc" location="..." />
> because whatever you put in 'location' is resolved relative to
> the project's 'basedir' a relative path is specified, or left
> absolute when it's absolute.
>
> You can then use
>   <property name="srcdir" location="src" />
> to refer to ${basedir}/src. --DD

Oh.  Sorry, I hadn't noticed the 'location' attribute of <property>
before!  That is nifty.

However, it doesn't help me in this case.

In my original example, the 'ant_loc' property stores the relative path
to the calling script, so that the script being called can locate it.

All our Ant scripts use the CVS repository root as their basedir, thus
'ant_loc' can always be resolved.  I haven't yet found a need for
absolute paths (for files in our CVS tree).  I find this to be a Good
Thing.

So, a calling script named /a/b/smsi/y/z/build.xml would use 'y/z' for
'ant_loc' (assuming the CVS tree root was /a/b/smsi, which is also the
basedir).  The called script can then use <ant dir="${ant_loc}" ...> to
find the callee.

Further, in Ant 1.4 anyway, <property location=...> seems to give me the
basedir, NOT the directory of the current Ant script, which is what I
need here.

Now ant.name gives me the full absolute path to the current Ant script,
but unfortunately it includes the filename (usually build.xml) as well.
And since I'm using this for the <ant dir=...> attribute, that won't
work either.

Anyway, in this exact case for our team, we will throw away all this Ant
code anyway, since both 1.4 and 1.5 can use the <target name="usage">
thang reposted by Dominique yesterday on this thread.


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message