blob: 534743ee9a895a449bedec546d8989c349ec42da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<?xml version="1.0"?>
<project name="variabletest" basedir="." default="test1">
<description>
test build file for the Variable task
</description>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath location="${antcontrib.jar}"/>
</taskdef>
<!-- use like a standard property -->
<target name="test1">
<var name="x" value="6" />
</target>
<!-- use like a standard property -->
<target name="test2">
<var name="x" value="12" />
</target>
<!-- can append to itself -->
<target name="test3">
<var name="x" value="12" />
<var name="x" value="6 + ${x}" /> <!-- 6 + 12 -->
</target>
<!-- property can't override -->
<target name="test4">
<var name="x" value="6" />
<property name="x" value="12" />
</target>
<!-- can append multiple times -->
<target name="test5">
<var name="str" value="I" />
<var name="str" value="${str} am" />
<var name="str" value="${str} a" />
<var name="str" value="${str} string." />
<!-- I am a string. -->
</target>
<!-- property can't override -->
<target name="test6">
<var name="x" value="blue" />
<tstamp>
<format property="x" pattern="EEEE" />
</tstamp>
<var name="x" value="Today is ${x}."/>
<!-- Today is blue. -->
</target>
<!-- can override property -->
<target name="test7">
<property name="x" value="12" />
<var name="x" value="6" />
</target>
<!-- TODO: uses the Antelope <if>, need to adjust to use ant-contrib <if>
<target name="test8">
<var name="x" value="6"/>
<if name="x" value="6">
<var name="x" value="12"/>
<else>
<var name="x" value="13"/>
</else>
</if>
<echo>${x}</echo>
</target>
-->
<target name="test9">
<property name="i" value="2"/>
<var name="i" unset="true"/>
</target>
<target name="test10">
<var name="x" value="test"/>
<var name="x" unset="true"/>
<property name="x" value="xxx"/>
</target>
</project>
|