ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: OS detection: am I missing the obvious?
Date Thu, 09 Nov 2000 02:16:38 GMT
--- Benjamin Reed <ranger@befunk.com> wrote:
> I'd welcome any input on our current build process, and whether there's
> better ways to do what I'm doing.
> 
> Our main build stuff can be viewed from cvsweb at
> http://www.opennms.org/cgi-bin/cvsweb.cgi/bluebird/

My suggestion would be to eliminate the redundancy. Whenever I have things
that get built the same way, I make a generic target, which I call with
<antcall>, passing the properties that the generic target needs. For
example, all those replicated <exec>'s to do your compiles in your
"native.icmpd" target. If you needed to change the way they're done, you'd
need to make the change in lots of places. But you could have a
"doNativeIcmpd" target instead, then just <antcall> to it with properties:
"${defs}", "${inc}", and $"{mod}" (or defines, includes, and module, if
you like typing :) Then, your generic target would reference ${defs} in
place of the hard-coded defines, ${inc} in place of the hard-coded
includes, and ${mod} in place of the hard-coded module name:
  <echo message="    [cc] compiling ${mod}.o"/>
  <exec executable=".....">
    <arg line="${compile.cflags} ${defs} ${inc} -c ${mod}.c -o ${mod}.o"/>
  </exec>

And your "native.icmpd" target does:
  <property name="def" value="-D_REENTRANT -D_DEBUG"/>
  <property name="inc" value="-I ."/>
  <antcall target="doNativeIcmpd">
    <param name="mod" value="acceptor"/>
  </antcall>
  <antcall target="doNativeIcmpld">
    <param name="mod" value="alloc"/>
  </antcall>
  ...

You could do something similar with your <javac> tasks as well, since they
all look to be the same.

I also like to put comments before my targets -- but then, I tend to
comment most everything I do (even little funky shell-scripts), since I
learned early on that, while I may know exactly what I'm doing when I'm
doing it, there's no guarantee I'll have any idea what I was doing when I
get back to it a year later. :)

Diane


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one Place.
http://shopping.yahoo.com/

Mime
View raw message