?

Log in

No account? Create an account

Uncharitable description of ant - Journal of Omnifarious

Nov. 28th, 2007

03:51 pm - Uncharitable description of ant

Previous Entry Share Next Entry

Well, some Java guy was annoyed with 'make' not for any of the many reasons people get annoyed with make, but because every time it compiled a Java file it started up the JVM to run the compiler. Starting the JVM ended up taking 4 or 5 times as much time as the compiler run did, so it was very slow. And even worse, make required something other than the most holy and perfect Java!

And this Java guy, being a Java guy, decided that it couldn't be Java that was the problem in this case, it must be make. So he wrote a build tool in Java called 'ant' that used a programming language based on XML (a bletcherous abomination if ever there was one) and invoked the Java compiler by just calling methods on it from within the same JVM ant was running inside so no JVM startup cost was incurred.

Now this horrible spawn of Java, XML and a declarative language for dependencies married to a procedural language for describing how they are updated is called 'ant'. And it's what Java projects everywhere use by default. It is one of the many reasons Java should be shunned.

Current Mood: [mood icon] annoyed

Comments:

From:srlamb
Date:November 29th, 2007 01:39 am (UTC)

Phony targets

(Link)
ant also has only what make calls "phony" targets - stupidly coarse ones not linked to a particular file (e.g., "compile" instead of "Foo.class") which skip the usual dependency timestamp checks before attempting to rebuild. Each build step is instead responsible for not redoing work. This is what I hate most about ant.

Still, I don't think this is really Java's fault. I don't think it's unreasonable to have a build step that most efficiently creates targets in bulk. I think scons can handle that now, and it's actually useful for building non-Java projects, too.
(Reply) (Thread)
[User Picture]
From:omnifarious
Date:November 29th, 2007 04:23 am (UTC)

Re: Phony targets

(Link)

I've been noticing that, and that's likely to really irritate me at some point, but it hasn't yet.

(Reply) (Parent) (Thread)
[User Picture]
From:smitty1e
Date:November 29th, 2007 03:23 am (UTC)

Preach it

(Link)
XML: eXtensible MARKUP Language.
Now, the fact that it's extensible doesn't really make it _more_ than a markup language, does it? Especially not a _scripting_ language, for ___'s sake.
Not to be a make apologist (it has its own warts) but the chief driver for ant probably had to do with getting away from the GPL, in the pre-Sun-likes-GPL days.
XML, used to write code, is really just Lisp beaten with an ugly stick, anyway.
Warts and all, Java is at least an ABM tool: Anything But Microsoft.
(Reply) (Thread)
From:rosencrantz319
Date:November 29th, 2007 11:39 am (UTC)
(Link)
(Reply) (Thread)
[User Picture]
From:pphaneuf
Date:November 29th, 2007 12:33 pm (UTC)
(Link)
There was also some rather annoying aspect, where it was next to impossible to have automatic dependencies (and life really suck without those!), but I think javac could have been fixed instead...
(Reply) (Thread)
[User Picture]
From:omnifarious
Date:December 5th, 2007 11:58 pm (UTC)

There is a fix

(Link)

The fix for javac is called jikes. It is not written in Java and so doesn't suffer Java's deficiencies as far as taking forever and a day to start up.

(Reply) (Parent) (Thread)
From:(Anonymous)
Date:December 6th, 2007 03:05 pm (UTC)

Re: There is a fix

(Link)
Ah, look at that, the fourth point on their front page is "dependency analysis", for makefile generation...
(Reply) (Parent) (Thread)
[User Picture]
From:omnifarious
Date:December 6th, 2007 12:00 am (UTC)

Of course, make is still broken for Java

(Link)

It can only auto-generate parts of its dependency graph in the most rudimentary of ways. And that isn't nearly sufficient for Java's use of a directory structure to mirror package structure. Since this is one of the things I happen to think Java got right this is a very disappointing limitation of make, amongst its many other warts and limitations.

(Reply) (Parent) (Thread)
From:(Anonymous)
Date:December 6th, 2007 03:03 pm (UTC)

Re: Of course, make is still broken for Java

(Link)
I think you could have made make support the directory structure, the real problem is that you can't quickly find out the dependencies of a given .java file. The "import" statements at the top are optional (and aren't really dependencies if they are never used), so you have to go through the whole code to find instantiations and references to things, doing the whole name lookup logic correctly.

Hence my comment that javac could give us that information, much like gcc does with the -M option. Maybe Jikes has that, I don't know, never tried it.

But there are big challenges to the directory structure thing. For example, how dependencies are actually on .class files (that's okay) which could be in .jar files (not so okay!). But I've seen pretty creative uses of GNU Make, I'm something could be done, especially if the Java compiler helps.
(Reply) (Parent) (Thread)
[User Picture]
From:ohpun
Date:November 29th, 2007 07:08 pm (UTC)
(Link)
I dunno. Converting from make to ant was a bit of a pain, but how often do you modify your [generic project creation] file? Now that the **** thing is set up, I only have to tweak it when I change compilers. So, it really does not matter to me whether I use make or ant or ??? because mostly I start the compile process, then wait until it is done.
(Reply) (Thread)
[User Picture]
From:redhotswing
Date:November 30th, 2007 06:44 am (UTC)
(Link)
There are worse things in the world. Like proprietary internal deployment/test xml scripting languages with no documentation that were written by interns.

XML is a data format, not a scripting language! *cries*
(Reply) (Thread)
From:(Anonymous)
Date:November 8th, 2008 09:38 am (UTC)

bite me ant

(Link)
Ant is an abomination. For an entirely usable make implemetation that only invokes javac once see the opensource gmake nutshell book.
ant is a totally uncessary invention that plays to the worst instincts of developers. It looks nothing like any programming language or build tool that precedes it and forces developers to learn a whole series of new procedures to do already well understood and suitably implented constructs.
for eg
if ( ! property already set) then ...
becomes





utilizing the oh so intuitive notion that properties aka variables are ALL immutable.

Dorkfingers of the world unite!
(Reply) (Thread)
From:(Anonymous)
Date:November 8th, 2008 09:38 am (UTC)

Re: bite me ant

(Link)
Ant is an abomination. For an entirely usable make implemetation that only invokes javac once see the opensource gmake nutshell book. ant is a totally uncessary invention that plays to the worst instincts of developers. It looks nothing like any programming language or build tool that precedes it and forces developers to learn a whole series of new procedures to do already well understood and suitably implented constructs. for eg if ( ! property already set) then ... becomes utilizing the oh so intuitive notion that properties aka variables are ALL immutable. Dorkfingers of the world unite!
(Reply) (Parent) (Thread)
From:(Anonymous)
Date:November 8th, 2008 09:40 am (UTC)

Re: bite me ant

(Link)
ate my code so here it is again without angle brackets condition property="testCond" value="${env.testCond}" isset property="env.testCond"/ /condition property name="testCond" value="default"
(Reply) (Parent) (Thread)
[User Picture]
From:omnifarious
Date:November 8th, 2008 11:05 am (UTC)

Re: bite me ant

(Link)

*grin* Luckily, I do not have to work with Ant anymore. How did you find this message that's nearly a year old now to respond to?

(Reply) (Parent) (Thread)