ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <step...@einsurance.de>
Subject Re: article: combining make and ant
Date Thu, 21 Mar 2002 13:50:27 GMT
On Thursday 21 March 2002 14:36 pm, Erik Hatcher wrote:
> ----- Original Message -----
> From: "stephan beal" <stephan@einsurance.de>
>
> > Make is, let's face it, far better at dependency checking than Ant
>
> Care to elaborate on this?  In what way is it better?

oooh, did i open up a can of worms, didn't i?
It's simpler to use make for dep checking in many cases (examples below). In 
the case of a whole source tree, ant is far easier, at least with source 
files. Setting up deps for non-java files is signficantly more difficult in 
ant.

Make examples:

%.white.png: %.black.png
	convert -negate $< $@

%.tab: %.txt
	perl myconverter < $< > $@


you can't get away with something as graceful as that in Ant.You can do the 
same job in ant, but you're looking at using filesets and some type of 
foreach iterator (which isn't in the core Ant 1.4.1). i won't for a moment 
propose that this type of "shortcut" be added to ant - i like the structured 
nature of ant files, i just don't always like writing that structure ;).


> > take advantage of make's dependency capabilities in allowing it to build
> our
> > custom Ant tasks before it runs the main build.
>
> You're saying Ant can't do this?


No, i'm saying it's more work to do in ant. Also, we MUST (in my case) run 
ant multiple times, because of the dependency on not-yet-built custom tasks. 
Ant *cannot* load our build.xml unless these tasks exist and are in the 
classpath before ant starts. Without some sort of front-end (make, batch 
file, whatever), the developer has to run ant twice. Make fills this gap for 
us.

> > The tasks must be built
> > before Ant is run on our source tree, and make takes care of that for us,
> > running ant once to build the tasks then once more to compile our source
> tree
> > (which uses those just-compiled tasks).
>
> You can easily build tasks in the same build file that uses them with Ant.

In our case, no we can't, because our build.xml contains <taskdefs> which do 
not exist when the build.xml is started. The build fails because it cannot 
instantiate the tasks. (i've tried.) Sure, if the developer wants to manually 
confirm that the custom tasks are built, he can get away without using ant. 
But as i work on the tasks' source code very often, i needed a shortcut for 
testing my tasks against our tree. i simply have to run 'make ant' and the 
double-ant-run is handled.

> Is that the dilemma you're solving by hooking make in to the front-end?

Actually, it was the other way around - by using make as my front-end i 
realized that i could easily handle the building of our custom tasks before 
launching the build, saving me manual steps (i'm fundamentally against manual 
steps ;).

> > running Unix machines, then a mix of make and Ant is a powerful
> combination.
> > While the purists (and Windows users ;) out there can justifiably argue,
> "we
> > must implement it all in build.xml, using Pure Ant and Java", i disagree.
> > We may as well use the tools available to us, especially when they make
> our
> > jobs easier.
>
> No argument with using what you know and what you've got.  I just want to
> understand what Ant cannot do for you in this scenario - of if you're just
> opting to cooperate with make because that is easiest for you.

Ant can do most of this stuff, but it cannot do some of the things as 
gracefully as make can. That's not a slight against ant at all - ant can do 
many things that are more difficult in make. For example, climbing down the 
source tree and building the whole thing effectively requires one Makefile 
for each dir, where Ant does it in a few lines of XML.


----- stephan
Generic Universal Computer Guy
stephan@einsurance.de - http://www.einsurance.de
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

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


Mime
View raw message