1 | <!--
|
---|
2 | * Copyright 2005 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | -->
|
---|
17 |
|
---|
18 | <project>
|
---|
19 | <property name="fooA" value="FooA"/>
|
---|
20 | <property name="barB" value="BarB"/>
|
---|
21 |
|
---|
22 | <propertyset id="properties-starting-with-foo">
|
---|
23 | <propertyref prefix="foo"/>
|
---|
24 | </propertyset>
|
---|
25 | <propertyset id="properties-starting-with-bar">
|
---|
26 | <propertyref prefix="bar"/>
|
---|
27 | </propertyset>
|
---|
28 | <propertyset id="my-set">
|
---|
29 | <propertyset refid="properties-starting-with-foo"/>
|
---|
30 | <propertyset refid="properties-starting-with-bar"/>
|
---|
31 | </propertyset>
|
---|
32 |
|
---|
33 | <macrodef name="expect.equals">
|
---|
34 | <attribute name="test"/>
|
---|
35 | <attribute name="exp"/>
|
---|
36 | <attribute name="got"/>
|
---|
37 | <sequential>
|
---|
38 | <fail message=
|
---|
39 | "@{test} failed: expected "@{exp}" got "@{got}"">
|
---|
40 | <condition>
|
---|
41 | <not>
|
---|
42 | <equals arg1="@{exp}" arg2="@{got}"/>
|
---|
43 | </not>
|
---|
44 | </condition>
|
---|
45 | </fail>
|
---|
46 | </sequential>
|
---|
47 | </macrodef>
|
---|
48 |
|
---|
49 | <target name="reference-to-two-references">
|
---|
50 | <expect.equals
|
---|
51 | test="reference to two references"
|
---|
52 | exp="barB=BarB, fooA=FooA"
|
---|
53 | got="${toString:my-set}"/>
|
---|
54 | </target>
|
---|
55 |
|
---|
56 | <target name="nested-mapped">
|
---|
57 | <propertyset id="nested-mapped">
|
---|
58 | <propertyset>
|
---|
59 | <propertyset refid="properties-starting-with-foo"/>
|
---|
60 | <globmapper from="foo*" to="boo*" />
|
---|
61 | </propertyset>
|
---|
62 | <propertyset>
|
---|
63 | <propertyset refid="properties-starting-with-bar"/>
|
---|
64 | <globmapper from="bar*" to="far*" />
|
---|
65 | </propertyset>
|
---|
66 | </propertyset>
|
---|
67 | <expect.equals
|
---|
68 | test="nested mapped propertysets"
|
---|
69 | exp="booA=FooA, farB=BarB"
|
---|
70 | got="${toString:nested-mapped}"/>
|
---|
71 | </target>
|
---|
72 |
|
---|
73 | <target name="nested-mapped-mapped">
|
---|
74 | <propertyset id="nested-mapped-mapped">
|
---|
75 | <propertyset>
|
---|
76 | <propertyset refid="properties-starting-with-foo"/>
|
---|
77 | <globmapper from="foo*" to="boo*" />
|
---|
78 | </propertyset>
|
---|
79 | <propertyset>
|
---|
80 | <propertyset refid="properties-starting-with-bar"/>
|
---|
81 | <globmapper from="bar*" to="far*" />
|
---|
82 | </propertyset>
|
---|
83 | <mapper>
|
---|
84 | <globmapper from="boo*" to="hoo*" />
|
---|
85 | <globmapper from="far*" to="near*" />
|
---|
86 | </mapper>
|
---|
87 | </propertyset>
|
---|
88 | <expect.equals
|
---|
89 | test="nested mapped propertysets"
|
---|
90 | exp="hooA=FooA, nearB=BarB"
|
---|
91 | got="${toString:nested-mapped-mapped}"/>
|
---|
92 | </target>
|
---|
93 |
|
---|
94 | </project>
|
---|