| 1 | <project default="invalid"> |
| 2 | <target name="invalid"> |
| 3 | <fail>Don't call this file directly.</fail> |
| 4 | </target> |
| 5 | |
| 6 | <target name="setup"> |
| 7 | <taskdef resource="net/sf/antcontrib/antcontrib.properties"> |
| 8 | <classpath location="${antcontrib.jar}"/> |
| 9 | </taskdef> |
| 10 | </target> |
| 11 | |
| 12 | <target name="noCondition" depends="setup"> |
| 13 | <if> |
| 14 | <then> |
| 15 | <echo>Foo</echo> |
| 16 | </then> |
| 17 | </if> |
| 18 | </target> |
| 19 | |
| 20 | <target name="twoConditions" depends="setup"> |
| 21 | <if> |
| 22 | <isset property="1"/> |
| 23 | <isset property="2"/> |
| 24 | <then> |
| 25 | <echo>Foo</echo> |
| 26 | </then> |
| 27 | </if> |
| 28 | </target> |
| 29 | |
| 30 | <target name="nothingToDo" depends="setup"> |
| 31 | <if> |
| 32 | <isset property="antcontrib.jar"/> |
| 33 | </if> |
| 34 | </target> |
| 35 | |
| 36 | <target name="twoThens" depends="setup"> |
| 37 | <if> |
| 38 | <isset property="antcontrib.jar"/> |
| 39 | <then/> |
| 40 | <then/> |
| 41 | </if> |
| 42 | </target> |
| 43 | |
| 44 | <target name="twoElses" depends="setup"> |
| 45 | <if> |
| 46 | <isset property="antcontrib.jar"/> |
| 47 | <else/> |
| 48 | <else/> |
| 49 | </if> |
| 50 | </target> |
| 51 | |
| 52 | <target name="normalOperation" depends="setup"> |
| 53 | <if> |
| 54 | <isset property="antcontrib.jar"/> |
| 55 | <then> |
| 56 | <echo>In then</echo> |
| 57 | <property name="inner" value="some value"/> |
| 58 | <echo>${inner}</echo> |
| 59 | </then> |
| 60 | <else> |
| 61 | <echo>In else</echo> |
| 62 | </else> |
| 63 | </if> |
| 64 | </target> |
| 65 | |
| 66 | <target name="normalOperation2" depends="setup"> |
| 67 | <if> |
| 68 | <not> |
| 69 | <isset property="antcontrib.jar"/> |
| 70 | </not> |
| 71 | <then> |
| 72 | <echo>In then</echo> |
| 73 | </then> |
| 74 | <else> |
| 75 | <echo>In else</echo> |
| 76 | </else> |
| 77 | </if> |
| 78 | </target> |
| 79 | |
| 80 | <target name="noConditionInElseif" depends="setup"> |
| 81 | <if> |
| 82 | <isset property="1"/> |
| 83 | <elseif> |
| 84 | <then> |
| 85 | <echo>Foo</echo> |
| 86 | </then> |
| 87 | </elseif> |
| 88 | </if> |
| 89 | </target> |
| 90 | |
| 91 | <target name="twoConditionsInElseif" depends="setup"> |
| 92 | <if> |
| 93 | <isset property="1"/> |
| 94 | <elseif> |
| 95 | <isset property="1"/> |
| 96 | <isset property="2"/> |
| 97 | <then> |
| 98 | <echo>Foo</echo> |
| 99 | </then> |
| 100 | </elseif> |
| 101 | </if> |
| 102 | </target> |
| 103 | |
| 104 | <target name="normalOperationElseif" depends="setup"> |
| 105 | <if> |
| 106 | <not> |
| 107 | <isset property="antcontrib.jar"/> |
| 108 | </not> |
| 109 | <then> |
| 110 | <echo>In then</echo> |
| 111 | </then> |
| 112 | <elseif> |
| 113 | <isset property="antcontrib.jar"/> |
| 114 | <then> |
| 115 | <echo>In elseif</echo> |
| 116 | </then> |
| 117 | </elseif> |
| 118 | <else> |
| 119 | <echo>In else-branch</echo> |
| 120 | </else> |
| 121 | </if> |
| 122 | </target> |
| 123 | |
| 124 | <target name="normalOperationElseif2" depends="setup"> |
| 125 | <if> |
| 126 | <not> |
| 127 | <isset property="antcontrib.jar"/> |
| 128 | </not> |
| 129 | <then> |
| 130 | <echo>In then</echo> |
| 131 | </then> |
| 132 | <elseif> |
| 133 | <not> |
| 134 | <isset property="antcontrib.jar"/> |
| 135 | </not> |
| 136 | <then> |
| 137 | <echo>In elseif</echo> |
| 138 | </then> |
| 139 | </elseif> |
| 140 | <else> |
| 141 | <echo>In else-branch</echo> |
| 142 | </else> |
| 143 | </if> |
| 144 | </target> |
| 145 | |
| 146 | </project> |