]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | <project name="x-slice-impl">\r |
2 | \r | |
3 | <target name="-load-sass-page" \r | |
4 | depends="-detect-app-build-properties,\r | |
5 | -generate-slicer-bootstrap,\r | |
6 | -generate-slicer-manifest">\r | |
7 | <x-run-if-true value="${app.sass.fashion}">\r | |
8 | <if>\r | |
9 | <x-is-false value="${app.sass.rhino}"/>\r | |
10 | <then>\r | |
11 | <x-get-relative-path from="${build.web.root}"\r | |
12 | to="${app.example.fashion.html}"\r | |
13 | property="app.example.fashion.html.relative"/>\r | |
14 | <property name="example.page.url"\r | |
15 | value="http://localhost:${build.web.port}/${app.example.fashion.html.relative}"/>\r | |
16 | <x-sass-page page="${app.example.fashion.html}"\r | |
17 | url="${example.page.url}"\r | |
18 | refId="app.web.server"/>\r | |
19 | </then>\r | |
20 | </if>\r | |
21 | </x-run-if-true>\r | |
22 | </target>\r | |
23 | \r | |
24 | <!--\r | |
25 | Uses the compiler to generate a special theme-only scss file containing\r | |
26 | rules for all framework / package / app components. This is then used\r | |
27 | by the slicer example page to capture theme sprites\r | |
28 | -->\r | |
29 | <target name="-compile-slicer-sass" depends="-init-compiler">\r | |
30 | <local name="app.example.scss.tmp"/>\r | |
31 | <property name="app.example.scss.tmp" value="${app.example.scss}.tmp"/>\r | |
32 | <x-normalize-path \r | |
33 | path="${build.out.resources.dir}" \r | |
34 | property="image.search.path"/>\r | |
35 | \r | |
36 | <local name="var.begin"/>\r | |
37 | <local name="var.end"/>\r | |
38 | \r | |
39 | <condition property="var.begin" value="dynamic(">\r | |
40 | <isset property="framework.isV6"/>\r | |
41 | </condition>\r | |
42 | <condition property="var.end" value=")">\r | |
43 | <isset property="framework.isV6"/>\r | |
44 | </condition>\r | |
45 | \r | |
46 | <property name="var.begin" value=""/>\r | |
47 | <property name="var.end" value="!default"/>\r | |
48 | \r | |
49 | <x-compile refid="${compiler.ref.id}">\r | |
50 | <![CDATA[\r | |
51 | restore\r | |
52 | page\r | |
53 | and\r | |
54 | include\r | |
55 | -all\r | |
56 | and\r | |
57 | sass\r | |
58 | +class-name-vars\r | |
59 | +etc\r | |
60 | +vars\r | |
61 | +rules\r | |
62 | -variable=$app-name: ${var.begin} '${app.name}' ${var.end}\r | |
63 | -variable=$image-search-path:'${image.search.path}'\r | |
64 | -variable=$theme-name: ${var.begin} '${theme.name}' ${var.end}\r | |
65 | -output=${app.example.scss.tmp}\r | |
66 | -forward=${app.sass.dynamic}\r | |
67 | and\r | |
68 | restore\r | |
69 | page\r | |
70 | and\r | |
71 | sass\r | |
72 | +ruby\r | |
73 | -output=${app.example.out.ruby}\r | |
74 | ]]>\r | |
75 | </x-compile>\r | |
76 | \r | |
77 | <if>\r | |
78 | <not>\r | |
79 | <filesmatch file1="${app.example.scss.tmp}" file2="${app.example.scss}"/>\r | |
80 | </not>\r | |
81 | <then>\r | |
82 | <copy file="${app.example.scss.tmp}" tofile="${app.example.scss}" overwrite="true"/>\r | |
83 | </then>\r | |
84 | </if>\r | |
85 | \r | |
86 | <x-get-relative-path from="${app.example.dir}"\r | |
87 | to="${app.example.css}"\r | |
88 | property="app.example.css.path"/>\r | |
89 | \r | |
90 | <!--update the app's example to point to the build output-->\r | |
91 | <echo file="${app.example.css.file}">\r | |
92 | <![CDATA[\r | |
93 | /*\r | |
94 | * This file is generated by Sencha Cmd and should NOT be edited. It redirects\r | |
95 | * to the most recently built CSS file for the application to allow theme.html\r | |
96 | * to load properly for image slicing (required to support non-CSS3 browsers\r | |
97 | * such as IE9 and below).\r | |
98 | */\r | |
99 | @import '${app.example.css.path}';\r | |
100 | ]]>\r | |
101 | </echo> \r | |
102 | </target>\r | |
103 | \r | |
104 | <!--\r | |
105 | Compiles the scss file for the theme slicer page\r | |
106 | -->\r | |
107 | <target name="-compass-compile-slicer-css" depends="-compile-slicer-sass">\r | |
108 | <if>\r | |
109 | <x-is-true value="${app.sass.fashion}"/>\r | |
110 | <then>\r | |
111 | <if>\r | |
112 | <x-is-true value="${app.sass.rhino}"/>\r | |
113 | <then>\r | |
114 | <x-fashion-compile\r | |
115 | file="${app.example.build.dir}"\r | |
116 | toFile="${app.example.build.dir}"/>\r | |
117 | </then>\r | |
118 | <else>\r | |
119 | <x-sass-build input="${app.example.build.dir}"\r | |
120 | output="${app.example.build.dir}"\r | |
121 | refId="app.web.server"\r | |
122 | compress="false"/>\r | |
123 | </else>\r | |
124 | </if>\r | |
125 | </then>\r | |
126 | <else>\r | |
127 | <x-compass-compile\r | |
128 | dir="${app.example.build.dir}"\r | |
129 | trace="${compass.compile.trace}"\r | |
130 | boring="${compass.compile.boring}"\r | |
131 | force="${compass.compile.force}"\r | |
132 | sassdir="${app.example.build.dir}"\r | |
133 | cssdir="${app.example.build.dir}"\r | |
134 | config="${app.example.compass.config}"/>\r | |
135 | </else>\r | |
136 | </if>\r | |
137 | </target>\r | |
138 | \r | |
139 | <!-- Produces a bootstrap.js file for ext 4.2 slicer pages -->\r | |
140 | <target name="-generate-slicer-bootstrap" unless="framework.isV5">\r | |
141 | <local name="relpath"/>\r | |
142 | <x-get-relative-path from="${bootstrap.base.path}"\r | |
143 | to="${framework.packages.dir}"\r | |
144 | property="relpath"/>\r | |
145 | \r | |
146 | <x-bootstrap file="${bootstrap.example.js}"\r | |
147 | basedir="${bootstrap.base.path}"\r | |
148 | includeBoot="true"\r | |
149 | includeCoreFiles="true"\r | |
150 | overrideTpl="${bootstrap.override.tpl}"\r | |
151 | overrideTplType="${bootstrap.override.tpltype}"\r | |
152 | overrideExcludeTags="">\r | |
153 | <![CDATA[\r | |
154 | Ext.Boot.loadSync([\r | |
155 | "render.js",\r | |
156 | "${relpath}/ext-theme-base/sass/example/manifest.js",\r | |
157 | "${relpath}/ext-theme-base/sass/example/shortcuts.js",\r | |
158 | "custom.js"\r | |
159 | ]);\r | |
160 | ]]>\r | |
161 | </x-bootstrap>\r | |
162 | \r | |
163 | </target>\r | |
164 | \r | |
165 | <!-- Produces a bootstrap.js / bootstrap.json pair for ext 5 slicer pages -->\r | |
166 | <target name="-generate-slicer-manifest" if="framework.isV5" depends="-detect-app-build-properties">\r | |
167 | <local name="manifest.root.excludes"/>\r | |
168 | <condition property="manifest.root.excludes" value="${app.bootstrap.manifest.exclude}">\r | |
169 | <isset property="app.bootstrap.manifest.exclude"/>\r | |
170 | </condition>\r | |
171 | <property name="manifest.root.excludes" value=""/>\r | |
172 | \r | |
173 | <if>\r | |
174 | <x-is-true value="${app.has.js.sdk}"/>\r | |
175 | <then>\r | |
176 | <property name="manifest.bootstrap.js.exclude">\r | |
177 | exclude\r | |
178 | -tag=framework,package-sencha-core,package-core,package-${toolkit.name}\r | |
179 | </property>\r | |
180 | <x-compile refid="${compiler.ref.id}">\r | |
181 | <![CDATA[\r | |
182 | restore\r | |
183 | page\r | |
184 | and\r | |
185 | ${manifest.bootstrap.js.exclude}\r | |
186 | ]]>\r | |
187 | </x-compile>\r | |
188 | </then>\r | |
189 | </if>\r | |
190 | \r | |
191 | <condition property="remove.slicer.css.bootstrap.entries" value="true">\r | |
192 | <and>\r | |
193 | <x-is-true value="${app.sass.fashion}"/>\r | |
194 | <x-is-false value="${app.sass.rhino}"/>\r | |
195 | </and>\r | |
196 | </condition>\r | |
197 | <property name="remove.slicer.css.bootstrap.entries" value="false"/>\r | |
198 | \r | |
199 | <x-compile refid="${compiler.ref.id}">\r | |
200 | <![CDATA[\r | |
201 | slicer-manifest\r | |
202 | -exclude=${manifest.root.excludes}\r | |
203 | -removeBootstrapCssEntries=${remove.slicer.css.bootstrap.entries}\r | |
204 | +ignoreDisabled\r | |
205 | -basePath=${bootstrap.base.path}\r | |
206 | -cssFile=${app.example.css.file}\r | |
207 | -out=${bootstrap.example.json}\r | |
208 | and\r | |
209 | microload\r | |
210 | -operation=microloader\r | |
211 | -microloaderPath=${build.slicer.microloader.file}\r | |
212 | -bootPath=${build.boot.file}\r | |
213 | -out=${bootstrap.example.js}\r | |
214 | ]]>\r | |
215 | </x-compile>\r | |
216 | </target>\r | |
217 | \r | |
218 | <target name="-capture-theme-image">\r | |
219 | <if>\r | |
220 | <or>\r | |
221 | <x-is-false value="${app.sass.fashion}"/>\r | |
222 | <x-is-true value="${app.sass.rhino}"/>\r | |
223 | </or>\r | |
224 | <then>\r | |
225 | <echo>Capture theme image to ${build.capture.png}</echo>\r | |
226 | <x-sencha-command>\r | |
227 | <![CDATA[\r | |
228 | theme\r | |
229 | capture\r | |
230 | -page=${app.example.theme.html}\r | |
231 | -image=${build.capture.png}\r | |
232 | -manifest=${build.capture.json}\r | |
233 | ]]>\r | |
234 | </x-sencha-command>\r | |
235 | </then>\r | |
236 | </if>\r | |
237 | </target>\r | |
238 | \r | |
239 | <target name="-capture-sass-page-image">\r | |
240 | <if>\r | |
241 | <and>\r | |
242 | <x-is-true value="${app.sass.fashion}"/>\r | |
243 | <x-is-false value="${app.sass.rhino}"/>\r | |
244 | </and>\r | |
245 | <then>\r | |
246 | <echo>Capture theme image to ${build.capture.png}</echo>\r | |
247 | <x-capture-slicer-data manifestPath="${build.capture.json}"\r | |
248 | imagePath="${build.capture.png}"\r | |
249 | refId="app.web.server"/>\r | |
250 | </then>\r | |
251 | </if>\r | |
252 | </target>\r | |
253 | \r | |
254 | <target name="-slice-theme-images">\r | |
255 | <echo>Slicing theme images to ${build.resources.dir}</echo>\r | |
256 | <x-sencha-command>\r | |
257 | <![CDATA[\r | |
258 | fs\r | |
259 | slice\r | |
260 | ${build.slice.options}\r | |
261 | -image=${build.capture.png}\r | |
262 | -manifest=${build.capture.json}\r | |
263 | -out=${build.out.slicer.path}\r | |
264 | ]]>\r | |
265 | </x-sencha-command>\r | |
266 | </target>\r | |
267 | \r | |
268 | \r | |
269 | <!--\r | |
270 | Generates theme images for Ext JS 4.2+ apps using theme packages\r | |
271 | '-detect-app-build-properties' is defined in js-impl.xml\r | |
272 | -->\r | |
273 | <target name="-slice-app-theme" \r | |
274 | depends="-load-sass-page,\r | |
275 | -compass-compile-slicer-css,\r | |
276 | -capture-sass-page-image,\r | |
277 | -capture-theme-image,\r | |
278 | -slice-theme-images">\r | |
279 | </target>\r | |
280 | \r | |
281 | <macrodef name="x-build-theme">\r | |
282 | <attribute name="theme" description="the path of the theme folder"/>\r | |
283 | <attribute name="buildsass" default="false"/>\r | |
284 | <attribute name="basetheme" default="default"/>\r | |
285 | <sequential>\r | |
286 | <local name="theme.name"/>\r | |
287 | \r | |
288 | <local name="framework.theme.dir"/>\r | |
289 | <local name="tmp.theme.dir"/>\r | |
290 | <local name="tmp.img.dir"/>\r | |
291 | \r | |
292 | <basename property="theme.name" file="@{theme}"/>\r | |
293 | <local name="theme.base.name"/>\r | |
294 | <property name="theme.base.name" value="${theme.name}"/>\r | |
295 | <property name="theme.images.dir" location="@{theme}/images"/>\r | |
296 | <property name="theme.page.dir" location="@{theme}/${theme.page.name}"/>\r | |
297 | \r | |
298 | <property name="tmp.res.dir" value="${app.resources.dir}"/>\r | |
299 | <property name="tmp.theme.dir" value="${tmp.res.dir}/${theme.base.name}"/>\r | |
300 | <property name="tmp.img.dir" value="${tmp.theme.dir}/images"/>\r | |
301 | \r | |
302 | <property name="app.res.dir" location="${app.dir}/packages"/>\r | |
303 | <property name="app.img.dir" location="${app.res.dir}/images"/>\r | |
304 | \r | |
305 | <property name="framework.res.dir" location="${framework.dir}/resources"/>\r | |
306 | <property name="framework.img.dir" location="${framework.res.dir}/themes/images"/>\r | |
307 | <property name="framework.theme.dir" location="${framework.img.dir}/@{basetheme}"/>\r | |
308 | \r | |
309 | <echo>Copying base framework images from ${framework.theme.dir} to ${tmp.img.dir}</echo>\r | |
310 | <copy todir="${tmp.img.dir}">\r | |
311 | <fileset dir="${framework.theme.dir}" includes="**/*"/>\r | |
312 | </copy>\r | |
313 | \r | |
314 | <if>\r | |
315 | <equals arg1="@{buildsass}" arg2="true"/>\r | |
316 | <then>\r | |
317 | <echo>Building sass for theme ${theme.name}</echo>\r | |
318 | <!--x-build-sass is defined in sass-impl.xml-->\r | |
319 | <x-build-sass theme="@{theme}"/>\r | |
320 | </then>\r | |
321 | </if>\r | |
322 | \r | |
323 | <echo>Slicing images for theme ${theme.name} to ${tmp.img.dir}</echo>\r | |
324 | <x-sencha-command>\r | |
325 | <![CDATA[\r | |
326 | theme\r | |
327 | build\r | |
328 | -data-file=${build.capture.json}\r | |
329 | -image-file=${build.capture.png}\r | |
330 | -page=${theme.page.dir}\r | |
331 | -out=${tmp.img.dir}\r | |
332 | ]]>\r | |
333 | </x-sencha-command>\r | |
334 | \r | |
335 | <if>\r | |
336 | <available file="${theme.images.dir}"/>\r | |
337 | <then>\r | |
338 | <echo>Copying user defined images from @{theme}/images to ${tmp.img.dir}</echo>\r | |
339 | <copy todir="${tmp.img.dir}">\r | |
340 | <fileset dir="${theme.images.dir}" includes="**/*"/>\r | |
341 | </copy>\r | |
342 | </then>\r | |
343 | </if>\r | |
344 | \r | |
345 | </sequential>\r | |
346 | </macrodef>\r | |
347 | \r | |
348 | <!--\r | |
349 | This is a legacy macrodef for copying resources in theme-directory based themes.\r | |
350 | It is provided to support building Ext JS 4.1 app themes\r | |
351 | -->\r | |
352 | <macrodef name="x-copy-resources">\r | |
353 | <sequential>\r | |
354 | <copy todir="${build.resources.dir}" includeEmptyDirs="false">\r | |
355 | <fileset dir="${app.resources.dir}" \r | |
356 | includes="**/*"/>\r | |
357 | </copy>\r | |
358 | \r | |
359 | <x-get-relative-path from="${app.dir}"\r | |
360 | to="${framework.dir}"\r | |
361 | property="framework.rel.path"/>\r | |
362 | \r | |
363 | <copy toDir="${build.out.base.path}/${framework.rel.path}">\r | |
364 | <fileset dir="${framework.dir}" \r | |
365 | includes="src/ux/**/css/**/*"/>\r | |
366 | </copy>\r | |
367 | </sequential>\r | |
368 | </macrodef>\r | |
369 | \r | |
370 | <!--\r | |
371 | Generates theme images for Ext JS 4.1 apps that use directory based\r | |
372 | themes. These have been deprecated in favor of ExtJS 4.2 theme packages\r | |
373 | -->\r | |
374 | <target name="-slice-theme-directories">\r | |
375 | <echo>Processing theme directories from ${app.theme.dir}</echo>\r | |
376 | <for param="theme">\r | |
377 | <dirset dir="${app.theme.dir}" includes="*"/>\r | |
378 | <sequential>\r | |
379 | <x-build-theme theme="@{theme}"/>\r | |
380 | </sequential>\r | |
381 | </for>\r | |
382 | <x-copy-resources/>\r | |
383 | </target>\r | |
384 | \r | |
385 | <target name="-slice-images">\r | |
386 | <x-run-if-true value="${enable.ext42.themes}">\r | |
387 | <x-ant-call target="-slice-app-theme"/>\r | |
388 | </x-run-if-true>\r | |
389 | <x-run-if-true value="${enable.ext41.themes}">\r | |
390 | <x-ant-call target="-slice-theme-directories"/>\r | |
391 | </x-run-if-true>\r | |
392 | </target>\r | |
393 | \r | |
394 | <target name="-before-slice"/>\r | |
395 | <target name="-slice" depends="-slice-images"/>\r | |
396 | <target name="-after-slice"/>\r | |
397 | \r | |
398 | <!--\r | |
399 | Refresh Individual Theme\r | |
400 | -->\r | |
401 | <target name="-before-refresh-theme"/>\r | |
402 | <target name="-refresh-theme">\r | |
403 | <if>\r | |
404 | <x-is-true value="${enable.ext41.themes}"/>\r | |
405 | <then>\r | |
406 | <local name="theme.dir"/>\r | |
407 | <property name="theme.dir" location="${app.theme.dir}/${args.themeName}"/>\r | |
408 | <x-build-theme theme="${theme.dir}" buildsass="true"/>\r | |
409 | <x-copy-resources/>\r | |
410 | </then>\r | |
411 | </if>\r | |
412 | </target>\r | |
413 | <target name="-after-refresh-theme"/>\r | |
414 | </project>\r |