Attachment 'build.xml.txt'

Download

   1 <?xml version="1.0" encoding="ISO-8859-1"?>
   2 
   3 <project name="jyant_test" default="test" basedir=".">
   4 
   5     <import file="jyant.xml"/>
   6 
   7     <target name="test" description="Jyant test">
   8         <!-- some testing stuff -->
   9         <script language="jython"><![CDATA[if 1:
  10             import sys, pprint
  11             project.log('jython.home=%s' % pprint.pformat(sys.prefix))
  12             ]]>
  13         </script>
  14 
  15         <jyant-info echo="true"><e/></jyant-info>
  16 
  17         <macrodef name="jyant-renamed">
  18             <sequential>
  19                 <jyant-info echo="false"/>
  20             </sequential>
  21         </macrodef>
  22         <jyant-renamed/>
  23 
  24         <!-- fun with our self -->
  25         <script taskname="self" language="jython"><![CDATA[if 1:
  26             self = bsf.lookupBean('self')
  27             print self
  28             getters = [
  29                 'getDescription', 
  30                 'getLocation', 
  31                 'getOwningTarget', 
  32                 'getRuntimeConfigurableWrapper', 
  33                 'getTaskName', 
  34                 'getTaskType', 
  35                 #'getWrapper',
  36             ]
  37             for getter in getters:
  38                 print "%s = %s" % (getter, getattr(self, getter)())
  39             ]]>
  40         </script>
  41 
  42         <!-- properties for the test cases -->
  43         <property name="dummy" value="no dot" />
  44         <property name="dummy.value" value="foo" />
  45         <property name="number" value="37" />
  46 
  47         <!-- property access and string manipulation 
  48             
  49              Note that you can call any string method on the properties.
  50           -->
  51         <eval property="dummy1" expression="dummy" />
  52         <echo message="dummy1 = ${dummy1}" />
  53         <eval property="dummy2" expression="dummy.replace('dot','.')" />
  54         <echo message="dummy2 = ${dummy2}" />
  55         <eval property="foobar" expression="dummy.value + 40 * '*'" />
  56         <echo message="foobar = ${foobar}" />
  57 
  58         <!-- using ant-contrib's try/catch, this could be a test case
  59         <eval property="dummy5" expression="dummy.int" />
  60         <echo message="dummy5 = ${dummy5}" />
  61         -->
  62 
  63         <!-- int arithmetics -->
  64         <eval property="number_plus_5" expression="number + 5" />
  65         <echo message="number+5 = ${number_plus_5}" />
  66         <eval property="five_plus_number" expression="5 + number" />
  67         <echo message="5+number = ${five_plus_number}" />
  68 
  69         <!-- bool arithmetics -->
  70         <eval property="true" expression="int(number_plus_5) > int(number)" />
  71         <echo message="true = ${true}" />
  72         <eval property="false" expression="int(number_plus_5) &lt; int(number)" />
  73         <echo message="false = ${false}" />
  74 
  75         <!-- comparisons similar to <condition> -->
  76         <evalcond property="life" expression="42 > 0"
  77              value="universe" else="everything" />
  78         <echo message="life = ${life}" />
  79         <evalcond property="life2" expression="42 > 4711"
  80              value="universe" else="everything" />
  81         <echo message="life2 = ${life2}" />
  82         <evalcond property="undefined" expression="42 > 4711"
  83              value="universe"/>
  84         <echo message="undefined = ${undefined}" />
  85         <evalcond property="must_be_true" expression="42 > 0"/>
  86         <echo message="must_be_true = '${must_be_true}'" />
  87 
  88         <!-- If -->
  89         <if condition="42 > 0">
  90             <then>
  91                 <echo message="TRUE! (OK)"/>
  92             </then>
  93             <else>
  94                 <echo message="FALSE! (FAIL)"/>
  95             </else>
  96         </if>
  97         <if condition="42 == 0">
  98             <then>
  99                 <echo message="TRUE! (FAIL)"/>
 100             </then>
 101             <else>
 102                 <echo message="FALSE! (OK)"/>
 103             </else>
 104         </if>
 105         <if condition="42 > 0">
 106             <else>
 107                 <echo message="FALSE! (FAIL)"/>
 108             </else>
 109         </if>
 110         <if condition="42 > 0">
 111             <then>
 112                 <echo message="TRUE! (OK)"/>
 113             </then>
 114         </if>
 115         <if condition="42 > 0">
 116             <then></then>
 117         </if>
 118         <if condition="42 == 0">
 119             <else></else>
 120         </if>
 121         <if condition="42 > 0">
 122         </if>
 123         <!-- FAILURE due to bad if! -->
 124         <echo message="Now cheching child element assertion..."/>
 125         <if condition="1">
 126             <then>
 127             </then>
 128             <then>
 129                 <echo message="2nd then!?"/>
 130             </then>
 131         </if> 
 132     </target>
 133 
 134     <target name="dist">
 135         <zip destfile="jyant.zip">
 136             <fileset dir=".">
 137                 <include name="*.xml"/>
 138                 <include name="*.py"/>
 139                 <exclude name="test.py"/>
 140             </fileset>
 141         </zip>
 142     </target>
 143 
 144 </project> 

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.