The Myrmidon-Ant1 Compatibility layer works by reusing most of the Ant 1 code,
with tasks and datatypes
being prefixed with "ant1." in build files. Almost all of the main Ant 1 tree
is included in the compatibility layer antlib. To insulate from changes in
the Ant 1 tree, Ant 1 class files are extracted from a jar, rather than
being compiled from scratch.
Here's how it works: The first time an Ant 1 task is encountered, an Ant 1
project is created, and stored in the TaskContext under the name "ant1.project".
The Ant 1 versions of Task and Project have been extended, overriding core behaviour,
with Myrmidon-specific behaviour.
The updated version of Task implements Configurable, receiving it's
complete Task Model, and actually setting/adding/creating attributes
with the help of the IntrospectionHelper. This process is designed to
mimic the Ant 1 configuration policy, although not all of the
subtle variations of configuration present in Ant 1 are handled.
The updated version of Project will provide hooks into the Myrmidon TaskContext,
such as:
- logging (done)
- properties (done)
- references (not yet done)
- Task defined by <taskdef> (done)
So at present, properties declared in Ant 2 tasks are available to all Ant 1 tasks,
and vice-versa. However, while a <ant1.path> reference works fine
in other <ant1.XXX>
tasks, it's not visible to Ant 2 tasks in the same build, and vice-versa.
The <taskdef> task 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 Ant 1 version of TypeInstanceTask in the descriptor.
The TransformingProjectBuilder (which is now the default builder for files
of type ".xml", applies a transformation stylesheet to the file, prefixing select
tasks (all at present) with "ant.". If a version attribute is encountered, the
file is not transformed