ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darrell DeBoer <>
Subject [myrmidon] Ant1 compatibility layer.
Date Thu, 14 Mar 2002 12:23:26 GMT

I've been playing around with an Ant1 compatibility layer for Myrmidon, and 
have made reasonable progress. I tried several different approaches, but the 
one I ended up with is very simple, and seems to serve the purpose well.

The good news is that the ant1compatibility layer can build itself using 
Myrmidon. Once we get an <ant> task (or substitute) for Myrmidon, I'm 
confident that we'll be able to build the entire thing.

The layer works by reusing most of the Ant1 code, with tasks and datatypes 
being prefixed with "ant1:" in build files. Almost all of the main Ant1 tree 
is included in the compatibility layer antlib. It's sort of cheating, because 
rather than try to imitate the Ant1 container, I just use it, but the 
approach seems to work well.

Here's how it works: The first time an Ant1 task is encountered, an Ant1 
project is created, and stored in the TaskContext. The Ant1 versions of Task 
and Project have been extended, with Task implementing Configurable so that 
it may can mimic the Ant1 configuration policy using the IntrospectionHelper.

The idea is to provide hooks between the Ant1 project and the Myrmidon 
project, like logging (done), properties (done but not quite working), 
references (not done), and Task definitions (done). So at present, while a 
<ant1:path> reference works fine in other <ant1:xxx> tasks, it's not visible 
to the rest of the build, and vice-versa. 

<taskdef> works ok, registering the task with the TypeManager using the 
"ant1:" prefix. Only a couple of DataTypes (Path and Patternset) are working 
as top-level types, but this should be just a matter of adding references to 
the Ant1 version of TypeInstanceTask in the descriptor.

Finally, I've included a dvsl stylesheet which converts an Ant1 build file 
into a Myrmidon one. Nothing fancy, just adds version="2.0", and prefixes 
everything with "ant1:".  The ant1compat build file target "ant1convert" 
converts an Ant1 build file into a Myrmidon one. (I've included a converted 
version of "ant1compat.xml" so you can then use Myrmidon to run the converter 
instead of Ant1.)

The plan would be to override this default behaviour to convert to use 
Myrmidon tasks where appropriate. But having the Ant1 tasks available as the 
default allows us to get a bunch of builds working (GUMP would be a good set 
of tests, I'd reckon ;) ), and then migrate accross to newer tasks as they 

Ok, the caveat. In order to avoid name collisions, I renamed the packages in 
"src/main", since they've been modified, but still have the Ant1 package 
names. I renamed to org.apache.conversion.*, but the details make little 
difference to my stuff, as long as other versions of* 
can't be found in the parent classloader.

A patch with the new files is included. Unzip into the myrmidon directory, 
and run "ant -f ant1compat.xml" to build the ant1 compatibility layer typelib 
into "dist/lib/ant1compat.atl".
Once you've done this, test it out with
    java -jar dist/bin/myrmidon-launcher.jar -f ant1compat.ant
Unfortunately, this won't work until you've moved the stuff in "main" out of 
the road, as mentioned above.

Please let me know what you reckon. There's heaps more work to do, but I'd be 
interested in some feedback.


View raw message