You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Apache Wiki <wi...@apache.org> on 2005/07/02 02:33:38 UTC

[Ant Wiki] Update of "AntSampleFiles/JythonAndAnt" by JürgenHermann

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ant Wiki" for change notification.

The following page has been changed by JürgenHermann:
http://wiki.apache.org/ant/AntSampleFiles/JythonAndAnt

New page:
#prgam section-numbers 2

= Using Jython scripting with Ant =

[[TableOfContents]]

== Description ==

The following build script, import script and python script define the `<eval>`, `<evalcond>` and `if` tasks that provide the full expression power of Jython to Ant scripts.

If you run `ant` after you saved all three files to a directory, you'll get output similar to this:
{{{
jython.home='D:\\jython-2.1'
[jyant-info] name = 'jyant'
[jyant-info] ant env = {'__name__': 'main', ...}
[jyant-info] modules = {..., 'jyant': <module jyant 2>, ...}
     [echo] dummy1 = no dot
     [echo] dummy2 = no .
     [echo] foobar = foo****************************************
     [echo] number+5 = 42
     [echo] 5+number = 42
     [echo] true = 1
     [echo] false = 0
     [echo] life = universe
     [echo] life2 = everything
     [echo] nolife = ${nolife}
     [echo] empty = 'true'
     [echo] number! (OK)
     [echo] FALSE! (OK)
     [echo] TRUE! (OK)
     [echo] Now cheching subelement assertion...
       [if] Traceback (innermost last):
       [if]   File "<string>", line 6, in ?
       [if]   File "jyant.py", line 99, in execute
       [if] AssertionError: Only one subelement <then> allowed!
}}}

== Files ==

=== build.xml ===

inline:build.xml.txt

=== jyant.xml ===

inline:jyant.xml.txt

=== jyant.py ===

inline:jyant.py

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org