ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Including files in build files
Date Fri, 05 Jul 2002 15:28:38 GMT
Answers below. --DD

-----Original Message-----
From: Jan.Lessner@bertelsmann.de [mailto:Jan.Lessner@bertelsmann.de] 
Sent: Friday, July 05, 2002 9:48 AM
To: ant-user@jakarta.apache.org
Subject: Including files in build files

Hello everybody
I'm about to prt existing Makefiles to Ant build scripts and came across
some problems:

1.
My Makefiles all include a common include file with common settings and
targets for all my independent sub-projects. I'm quite happy with that
concept and therefore would like to know if there is a similar feature in
Ant too. I've read something in the FAQs that I could perform this the
XML-way. But this looks pretty nasty to me, keeping in mind that the reason
for using common include files is to make the actual build scripts very,
very simple.

[DD] No in official Ant yet, but by using the provided patch (to a single
source file) on Ant 1.5 from CVS (ANT_15_BRANCH), you can compile yourself a
distrib of Ant that supports <import>:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10276 

Also, see http://marc.theaimsgroup.com/?l=ant-user&m=102573753820471&w=2 for
an alterative way to emulate <import> without having to modify Ant at all.
The only drawback I see is that you must play with the Ant classpath to find
your common.xml (instead of being able to do that in the build.xml itself),
and specify that property to get the new type of URL stream handler
registered with the VM (but the latter can be dealt with by either modifying
ant.{bat|sh} or using ANT_OPTS).

I personally think that <import> as implemented is not that clean, because
of the fact that current Ant uses SAX to build the project file instead of
DOM. Using the DOM (or jdom, or whatever), if would be trivial to implement
<import>, and make it even more powerful by use XPATH-like query strings to
import selective part, modify attributes/properties of the pieces imported,
with features similar to xslt. But that's too big a programming challenge
for me. More than you wanted to know I'm sure... ;-)

2.
Is there a built-in property providing the current target? This is nice for
recursive propagation without writing indivual targets.

[DD] Not built-in to Ant. But Diane Holt posted a little <script>let that
did just that. See
http://marc.theaimsgroup.com/?l=ant-user&m=102381670708535&w=2
and the two 'Next in Thread' posts. 

3.
Can I refer to environment variables?

[DD] Yes, using
<property environment="env"/>
<property name="Value of Path env. var." value="${env.Path}"/>

Cheers,
Jan Lessner


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

--
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