]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | <project name="x-sub-builds-impl">\r |
2 | \r | |
3 | <macrodef name="x-process-sub-packages">\r | |
4 | <attribute name="all" default="false"/>\r | |
5 | <element name="tasks" implicit="true"/>\r | |
6 | <sequential>\r | |
7 | <if>\r | |
8 | <and>\r | |
9 | <isset property="package.subpkgs.dir"/>\r | |
10 | <available file="${package.subpkgs.dir}" type="dir"/>\r | |
11 | </and>\r | |
12 | <then>\r | |
13 | <local name="sub.packages.list"/>\r | |
14 | <condition property="sub.packages.list" value="${package.subpkgs}">\r | |
15 | <and>\r | |
16 | <isset property="package.subpkgs"/>\r | |
17 | <equals arg1="@{all}" arg2="false"/>\r | |
18 | </and>\r | |
19 | </condition>\r | |
20 | <property name="sub.packages.list" value="*"/>\r | |
21 | <for param="pkg-dir">\r | |
22 | <dirset dir="${package.subpkgs.dir}" includes="${sub.packages.list}"/>\r | |
23 | <sequential>\r | |
24 | <if>\r | |
25 | <available file="@{pkg-dir}/.sencha/package/sencha.cfg"/>\r | |
26 | <then>\r | |
27 | <tasks/>\r | |
28 | </then>\r | |
29 | </if>\r | |
30 | </sequential>\r | |
31 | </for>\r | |
32 | </then>\r | |
33 | </if>\r | |
34 | </sequential>\r | |
35 | </macrodef>\r | |
36 | \r | |
37 | <macrodef name="x-process-examples">\r | |
38 | <attribute name="all" default="false"/>\r | |
39 | <element name="tasks" implicit="true"/>\r | |
40 | <sequential>\r | |
41 | <local name="example.apps"/>\r | |
42 | <local name="example.path"/>\r | |
43 | <local name="example.dir"/>\r | |
44 | \r | |
45 | <condition property="example.apps" value="*">\r | |
46 | <equals arg1="@{all}" arg2="true"/>\r | |
47 | </condition>\r | |
48 | <condition property="example.apps" value="${package.example.apps}">\r | |
49 | <isset property="package.example.apps"/>\r | |
50 | </condition>\r | |
51 | <condition property="example.apps" value="${package.examples}">\r | |
52 | <isset property="package.examples"/> <!-- legacy value -->\r | |
53 | </condition>\r | |
54 | \r | |
55 | <condition property="example.path" value="${package.example.path}">\r | |
56 | <isset property="package.example.path"/>\r | |
57 | </condition>\r | |
58 | <condition property="example.path" value="${package.examples.dir}">\r | |
59 | <isset property="package.examples.dir"/> <!-- legacy value -->\r | |
60 | </condition>\r | |
61 | \r | |
62 | <if>\r | |
63 | <isset property="example.path"/>\r | |
64 | <then>\r | |
65 | <for list="${example.path}" delimiter="," param="dir">\r | |
66 | <sequential>\r | |
67 | <x-canonical-path property="example.dir" overwrite="true"\r | |
68 | path="@{dir}"\r | |
69 | basedir="${package.dir}"/>\r | |
70 | \r | |
71 | <x-echo>Processing examples in "@{dir}" (${example.dir})</x-echo>\r | |
72 | \r | |
73 | <if>\r | |
74 | <isset property="example.apps"/>\r | |
75 | <then>\r | |
76 | <for list="${example.apps}" delimiter="," param="app">\r | |
77 | <sequential>\r | |
78 | <if>\r | |
79 | <available file="${example.dir}/@{app}/.sencha/app/sencha.cfg"/>\r | |
80 | <then>\r | |
81 | <!--\r | |
82 | Use for loop so <tasks> can use the\r | |
83 | pieces @{app} and @{dir} of the full\r | |
84 | path @{example-dir}\r | |
85 | -->\r | |
86 | <for param="example-dir">\r | |
87 | <dirset dir="${example.dir}" includes="@{app}"/>\r | |
88 | <sequential>\r | |
89 | <tasks/>\r | |
90 | </sequential>\r | |
91 | </for>\r | |
92 | </then>\r | |
93 | <else>\r | |
94 | <if>\r | |
95 | <available file="${example.dir}/@{app}" type="dir"/>\r | |
96 | <then>\r | |
97 | <x-echo>No app at ${example.dir}/@{app}</x-echo>\r | |
98 | </then>\r | |
99 | </if>\r | |
100 | </else>\r | |
101 | </if>\r | |
102 | </sequential>\r | |
103 | </for>\r | |
104 | </then>\r | |
105 | <elseif>\r | |
106 | <available file="@{dir}" type="dir"/>\r | |
107 | <then>\r | |
108 | <for param="example-dir">\r | |
109 | <dirset dir="@{dir}" includes="*"/>\r | |
110 | <sequential>\r | |
111 | <if>\r | |
112 | <available file="@{example-dir}/.sencha/app/sencha.cfg"/>\r | |
113 | <then>\r | |
114 | <tasks/>\r | |
115 | </then>\r | |
116 | </if>\r | |
117 | </sequential>\r | |
118 | </for>\r | |
119 | </then>\r | |
120 | </elseif>\r | |
121 | </if>\r | |
122 | </sequential>\r | |
123 | </for>\r | |
124 | </then>\r | |
125 | </if>\r | |
126 | </sequential>\r | |
127 | </macrodef>\r | |
128 | \r | |
129 | <macrodef name="x-run-sub-build">\r | |
130 | <attribute name="dir"/>\r | |
131 | <attribute name="target"/>\r | |
132 | <element name="properties" implicit="true"/>\r | |
133 | <sequential>\r | |
134 | <if>\r | |
135 | <available file="@{dir}/build.xml"/>\r | |
136 | <then>\r | |
137 | <local name="sub.name"/>\r | |
138 | <basename file="@{dir}" \r | |
139 | property="sub.name"/>\r | |
140 | <ant dir="@{dir}" \r | |
141 | inheritall="false" \r | |
142 | inheritrefs="true"\r | |
143 | target="@{target}">\r | |
144 | <property name="compiler.ref.id" value="compiler-${sub.name}"/>\r | |
145 | <properties/>\r | |
146 | </ant>\r | |
147 | </then>\r | |
148 | </if>\r | |
149 | </sequential>\r | |
150 | </macrodef>\r | |
151 | \r | |
152 | <macrodef name="x-sub-build">\r | |
153 | <attribute name="dir"/>\r | |
154 | <attribute name="target" default="build"/>\r | |
155 | <attribute name="inherit-version" default="0"/>\r | |
156 | <sequential>\r | |
157 | <if>\r | |
158 | <x-is-true value="@{inherit-version}"/>\r | |
159 | <then>\r | |
160 | <x-run-sub-build dir="@{dir}" target="@{target}">\r | |
161 | <property name="cmd.dir" value="${cmd.dir}"/>\r | |
162 | <property name="build.version" value="${build.version}"/>\r | |
163 | </x-run-sub-build>\r | |
164 | </then>\r | |
165 | <else>\r | |
166 | <x-run-sub-build dir="@{dir}" target="@{target}">\r | |
167 | <property name="cmd.dir" value="${cmd.dir}"/>\r | |
168 | </x-run-sub-build>\r | |
169 | </else>\r | |
170 | </if>\r | |
171 | </sequential>\r | |
172 | </macrodef>\r | |
173 | \r | |
174 | <target name="-before-subpkgs"/>\r | |
175 | <target name="-after-subpkgs"/>\r | |
176 | <target name="-subpkgs">\r | |
177 | <x-process-sub-packages>\r | |
178 | <local name="sub.name"/>\r | |
179 | <basename file="@{pkg-dir}"\r | |
180 | property="sub.name"/>\r | |
181 | <x-echo>Building sub package ${sub.name}</x-echo>\r | |
182 | <if>\r | |
183 | <x-is-true value="${build.subpkgs.inherit.version}"/>\r | |
184 | <then>\r | |
185 | <x-sencha-command dir="@{pkg-dir}" inheritall="false">\r | |
186 | <property name="compiler.ref.id" value="compiler-${sub.name}"/>\r | |
187 | <property name="build.version" value="${build.version}"/>\r | |
188 | <property name="package.sass.rhino" value="${package.sass.rhino}"/>\r | |
189 | package\r | |
190 | build\r | |
191 | </x-sencha-command>\r | |
192 | </then>\r | |
193 | <else>\r | |
194 | <x-sencha-command dir="@{pkg-dir}" inheritall="false">\r | |
195 | <property name="compiler.ref.id" value="compiler-${sub.name}"/>\r | |
196 | <property name="package.sass.rhino" value="${package.sass.rhino}"/>\r | |
197 | package\r | |
198 | build\r | |
199 | </x-sencha-command>\r | |
200 | </else>\r | |
201 | </if>\r | |
202 | </x-process-sub-packages>\r | |
203 | </target>\r | |
204 | \r | |
205 | <target name="-before-clean-subpkgs"/>\r | |
206 | <target name="-after-clean-subpkgs"/>\r | |
207 | <target name="-clean-subpkgs">\r | |
208 | <x-process-sub-packages>\r | |
209 | <x-echo>Cleaning sub package in @{pkg-dir}</x-echo>\r | |
210 | <x-sub-build dir="@{pkg-dir}"\r | |
211 | target="clean"\r | |
212 | inherit-version="${build.subpkgs.inherit.version}"/>\r | |
213 | </x-process-sub-packages>\r | |
214 | </target>\r | |
215 | \r | |
216 | <target name="-before-upgrade-subpkgs"/>\r | |
217 | <target name="-after-upgrade-subpkgs"/>\r | |
218 | <target name="-upgrade-subpkgs">\r | |
219 | <x-process-sub-packages>\r | |
220 | <x-echo>Upgrading sub package in @{pkg-dir}</x-echo>\r | |
221 | <x-sencha-command dir="@{pkg-dir}" inheritall="false">\r | |
222 | <property name="args.force" value="true"/>\r | |
223 | package\r | |
224 | upgrade\r | |
225 | </x-sencha-command>\r | |
226 | <delete dir="@{example-dir}/.sencha_backup"/>\r | |
227 | </x-process-sub-packages>\r | |
228 | </target>\r | |
229 | \r | |
230 | <target name="-before-examples"/>\r | |
231 | <target name="-after-examples"/>\r | |
232 | <target name="-examples">\r | |
233 | <x-process-examples>\r | |
234 | <x-echo>Building example in @{example-dir}</x-echo>\r | |
235 | <x-sencha-command dir="@{example-dir}" inheritall="false">\r | |
236 | <property name="app.sass.rhino" value="${package.sass.rhino}"/>\r | |
237 | app\r | |
238 | build\r | |
239 | </x-sencha-command>\r | |
240 | </x-process-examples>\r | |
241 | </target>\r | |
242 | \r | |
243 | <target name="-before-upgrade-examples"/>\r | |
244 | <target name="-after-upgrade-examples"/>\r | |
245 | <target name="-upgrade-examples">\r | |
246 | <x-process-examples>\r | |
247 | <x-echo>Upgrading example in @{example-dir}</x-echo>\r | |
248 | <x-sencha-command dir="@{example-dir}" inheritall="false">\r | |
249 | <property name="args.force" value="true"/>\r | |
250 | app\r | |
251 | upgrade\r | |
252 | </x-sencha-command>\r | |
253 | <delete dir="@{example-dir}/.sencha_backup"/>\r | |
254 | </x-process-examples>\r | |
255 | </target>\r | |
256 | \r | |
257 | <target name="-before-clean-examples"/>\r | |
258 | <target name="-after-clean-examples"/>\r | |
259 | <target name="-clean-examples">\r | |
260 | <x-process-examples>\r | |
261 | <x-echo>Cleaning example in @{example-dir}</x-echo>\r | |
262 | <x-sub-build dir="@{example-dir}"\r | |
263 | target="clean"/>\r | |
264 | </x-process-examples>\r | |
265 | </target>\r | |
266 | \r | |
267 | <target name="list-examples" depends="init"\r | |
268 | description="List all example apps for this package">\r | |
269 | <x-process-examples>\r | |
270 | <x-echo> @{example-dir}</x-echo>\r | |
271 | </x-process-examples>\r | |
272 | </target>\r | |
273 | \r | |
274 | </project>\r |