Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] gpg AKA ant




--- "J. David Beutel" <jdb@example.com> wrote:
> On Sun, 17 Aug 2003, Jake Morrison wrote:
> 
> > Make certainly has its weaknesses, but I have never really 
> > liked Ant. The Ant build files are very verbose compared to
> > make, often typically three times the size. The main
> > reason for its existence seems to be that javac doesn't
> > work the same as standard Unix compilers, so the makefiles
> > are a pain to write. What was Sun thinking? 
> > And the whole idea of writing cross-platform
> > make extensions in Java is disturbing, considering Java's
> > "least common denominator" approach to OS interfaces. 
> > Compared to GNU Make + external programs or SCons
> > (http://www.scons.org/) Ant is really not very impressive.
> 
> In ant's defense,
> 
> 1. It handles groups of files better than make.  E.g.,
> <javac 
> 	src="src/java" 
> 	includes="util/**/*.java,**/core/**/*.java" 
> 	excludes="**/*Test*"/>

So, you want to automatically compile .java files to .class files?

For normal C compilers, that would be a single rule like this:
.c.o:
    $(CC) $(CFLAGS) -c $<

But Java's directory structure for classes makes that
difficult. And why do you need a subdirectory for your 
utils? Because Java puts one class per file, which is a pain. 

Make was designed for more sane languages, and doesn't 
natively support Java wierdness. But you can do funky 
stuff if necessary:

Make has wildcards, e.g. 
SRCS := $(wildcard *.c)
or
SRCS := $(wildcard a/* b/* c/* d/*)

If you really want to do stuff like that in subdirectories,
you can use shell, e.g.
SRCS = $(shell find . -name \*.java |grep -v Test) 

For more fun, see the GNU make manual:
http://www.gnu.org/manual/make-3.80/html_chapter/make_8.html

> 
> 2. It provides access to many Java APIs, e.g., <junit>, <sql>,
> <xslt>.

Part of the problem is that Java is not usable as a scripting
language due to long startup times and the difficulty
of doing I/O and string manipulation. So this stuff has to be
built into the make tool to get reasonable performance and
ease of use. 

With make you can easily do xslt transformation using an 
external program, without it needing to explicity support 
an API:

output.xml: input.xml
    xsltproc -o output.xml stylesheet.xslt input.xml

Of course then there is a dependency on the external 
tool... 

> 
> 3. It's cross-platform.  Make isn't (except for trivial stuff).

This is more the fault of the shell than make, per se. 
You can run cygwin to get a Unix shell on Windows. 

My solution to this whole problem is to use Python
instead of Java. Or Jython when I have to run on
the JVM :-)

> 
> 4. It's the de facto standard for Java.

That it is. Now try using it for C++ :-)
As you might expect, a make tool designed for a 
particular language will work pretty well for that 
language. So when I code in Java, I use Ant. But
I don't like it in general. 

> 
> 11011011

Jake


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links