So I had a go at writing a Jython equivalent of an ANT script at the weekend. I reckon it should be possible, but the syntax and structure would have to change, which I wanted to minimize (cos if I can do that its conceivable that I could parse ANT’s XML and generate Jython automatically which would be cool). It might be possible to do something with Jython’s variable argument ‘*args’ syntax, but the output could look very odd.
The issue is in the nesting. How to make
<project> <target name="dostuff" > <copy> <!-- copy stuff --> </copy> <javac> <!-- javac stuff --> </javac> </target> </project>
look like Jython? The closest representation would probably look a bit like:
foo = project( target("dostuff", copy( srcdir="src", destdir="foo" ), javac( srcdir="foo", destdir="bar" ) ) )
but it would get hairy with all of ANT’s optional attributes. I’m loath to admit it, but I think the closest direct language representation would be obtained by using Lisp or Scheme. Now that I know about SISC, that might be worth a try.