Hello, I recently came across Jython. As a short *exercise*, I decided to add a "if-like" task to Ant using Python as the underlying expression language. Example code is provided as an attachment.
Why Python? Python is a pretty cool scripting language. More importantly, using Jython it is very easy to cross the Java/Python language barrier. IfPython.java is a very small task that illustrates the manipulation of ant project properties using arbitrary Python expressions. Note that IfPython is just a normal task. There is no need to change the ANT architecture to accommodate complex boolean expressions. The idea is to use the powerful Python interpreter to evaluate complex expressions and return the results in the form of project properties. These project properties can then be used to control the execution of ANT targets. In addition to ANT, you will need jython (http://jython.org) to compile and execute the example code (written in Java and Python). The code is intended as proof of concept with no pretension at reusability or reliability. Regards, Ceki ps: I apologize in advance if this is all redundant/boring stuff that has been proposed a million times in the past. ps: If the attachment fails, you can get the code at http://apache.org/~ceki/ifp.zip -- Ceki G�lc� - http://qos.ch
<<attachment: ifp.ZIP>>
