forked from liferay/alloy-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
460 lines (374 loc) · 13.2 KB
/
build.xml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
<?xml version="1.0"?>
<project name="Alloy" basedir="." default="release">
<property name="project.dir" value="."/>
<property environment="env" />
<property file="${project.dir}/build.${user.name}.properties" />
<property file="${project.dir}/build.${env.COMPUTERNAME}.properties" />
<property file="${project.dir}/build.${env.HOST}.properties" />
<property file="${project.dir}/build.${env.HOSTNAME}.properties" />
<property file="${project.dir}/build.properties" />
<import file="resources/builder/bootstrap.xml"/>
<target name="all" depends="build-aui, init-yui"/>
<target name="build-aui" depends="build-components, build-modules, build-skins, clean"/>
<target name="build-gallery" depends="build-gallery-templates, build-gallery-components, build-gallery-skins, build-gallery-modules, generate-skin-src, clean-module-src, clean-gallery-templates, export-gallery" />
<target name="build-gallery-templates">
<echo>Backing up templates</echo>
<copy todir="${project.dir}/resources/builder/_new_templates">
<fileset dir="${project.dir}/resources/builder/templates"/>
</copy>
<replace file="${project.dir}/resources/builder/_new_templates/moduledefaults.txt">
<replacefilter token="classNamePrefix: 'aui'," value="" />
</replace>
<move todir="${project.dir}/resources/builder/_old_templates">
<fileset dir="${project.dir}/resources/builder/templates"/>
</move>
<move todir="${project.dir}/resources/builder/templates">
<fileset dir="${project.dir}/resources/builder/_new_templates"/>
</move>
</target>
<target name="clean-gallery-templates">
<echo>Cleaning up templates</echo>
<move todir="${project.dir}/resources/builder/templates" overwrite="true">
<fileset dir="${project.dir}/resources/builder/_old_templates"/>
</move>
</target>
<target name="build-gallery-components" depends="remove-whitespace">
<subant target="all">
<fileset dir="${project.dir}/src/">
<exclude name="build.xml" />
<exclude name="${build.aui.prefix}aui-skin-*/build.xml" />
<include name="**/build.xml" />
</fileset>
</subant>
</target>
<target name="build-gallery-modules">
<create-module-list prependdefaults="false"/>
</target>
<target name="build-gallery-skins">
<antcall target="build-skins-core" />
</target>
<target name="build-components" depends="remove-whitespace">
<subant target="all">
<fileset
dir="${project.dir}/src/"
excludes="build.xml, aui-skin-*/build.xml, aui-skin-*/**/build.xml"
includes="**/build.xml"
/>
</subant>
</target>
<target name="build-modules">
<subant target="all">
<fileset
dir="${project.dir}/src/aui-base/"
includes="**/build.xml"
/>
</subant>
<create-module-list/>
</target>
<target name="export-gallery">
<if>
<isset property="github.gallery.directory" />
<then>
<copy todir="${github.gallery.directory}/src" overwrite="true">
<fileset dir="${project.dir}/src">
<exclude name="**/build_*"/>
<exclude name="**/_diffs/**"/>
<exclude name="**/build.all-css.*"/>
</fileset>
</copy>
</then>
</if>
</target>
<target name="clean-module-src">
<delete includeemptydirs="true">
<fileset dir="${project.dir}/src/" defaultexcludes="false">
<include name="**/*build_tmp*/**" />
<include name="**/*build_rollup_tmp*/**" />
</fileset>
</delete>
</target>
<target name="create-module-list">
<create-module-list/>
</target>
<target name="build-skins-core">
<antcall target="generate-skin-src" />
<delete dir="${project.dir}/src/${build.aui.prefix}aui-skin-*/build_tmp" />
<subant target="local">
<property name="clean.skip" value="true"/>
<fileset dir="${project.dir}/src">
<include name="${build.aui.prefix}aui-skin-*/build*.xml"/>
</fileset>
</subant>
<!-- Deploy to the build directory -->
<copy todir="${project.dir}/build" overwrite="true">
<fileset dir="${project.dir}/src">
<include name="${build.aui.prefix}aui-skin-*/css/**"/>
<include name="${build.aui.prefix}aui-skin-*/images/**"/>
<include name="${build.aui.prefix}aui-skin-*/build_tmp/**"/>
</fileset>
</copy>
<!-- Move the built files into the CSS directory -->
<for param="dir">
<path>
<dirset
dir="${project.dir}/build"
includes="${build.aui.prefix}aui-skin-*"
/>
</path>
<sequential>
<copy todir="@{dir}/css" overwrite="true">
<fileset dir="@{dir}/build_tmp" includes="*"/>
</copy>
</sequential>
</for>
<delete includeemptydirs="true">
<fileset dir="${project.dir}/build">
<include name="${build.aui.prefix}aui-skin-*/build_tmp/**"/>
<include name="${build.aui.prefix}aui-skin-*/build_tmp"/>
</fileset>
</delete>
</target>
<target name="build-skins">
<antcall target="build-skins-core"/>
<create-module-list/>
</target>
<target name="clean-skin-src">
<for param="dir">
<path>
<dirset
dir="${project.dir}/src"
includes="${build.aui.prefix}aui-skin-*"
excludes="${build.aui.prefix}aui-skin-base"
/>
</path>
<sequential>
<delete includeemptydirs="true">
<fileset dir="@{dir}">
<include name="**/*"/>
<exclude name="_diffs/**"/>
</fileset>
</delete>
</sequential>
</for>
</target>
<target name="generate-skin-src">
<for param="dir">
<path>
<dirset
dir="${project.dir}/src"
includes="${build.aui.prefix}aui-skin-*"
excludes="${build.aui.prefix}aui-skin-base"
/>
</path>
<sequential>
<basename property="skin.name" file="@{dir}"/>
<!-- Copy over everything from our base theme -->
<copy todir="@{dir}" overwrite="true">
<fileset dir="${project.dir}/src/${build.aui.prefix}aui-skin-base">
<include name="**"/>
<exclude name="build_tmp"/>
<exclude name="build_tmp/**"/>
</fileset>
</copy>
<!-- Create the build.all-css files -->
<copy todir="@{dir}" overwrite="true">
<fileset dir="${project.dir}/src/${build.aui.prefix}aui-skin-base">
<include name="build.*"/>
</fileset>
<mapper type="regexp" from="build\.(.*)" to="build.all-css.\1"/>
</copy>
<!-- Guarantee load order to be after the base -->
<replace file="@{dir}/build.properties">
<replacefilter token="${build.aui.prefix}aui-skin-base" value="${skin.name}" />
<replacefilter token="#component.requires=" value="component.requires=${build.aui.prefix}aui-skin-base" />
</replace>
<!-- Remove all component.cssfiles *except* the custom.css one -->
<replaceregexp match="component\.cssfiles=(.*)$" replace="component.cssfiles=custom.css" flags="g" byline="true">
<fileset dir="@{dir}/" includes="build.properties"/>
</replaceregexp>
<!-- Process the build.all-css files -->
<replace file="@{dir}/build.all-css.properties">
<replacefilter token="${build.aui.prefix}aui-skin-base" value="${skin.name}-all" />
<replacefilter token="global.build.component.assets=$${srcdir}/build/$${component}" value="global.build.component.assets=$${srcdir}/build/${skin.name}" />
<replacefilter token="${skin.name}-all/" value="${skin.name}/" />
</replace>
<replace file="@{dir}/build.all-css.xml">
<replacefilter token="build.properties" value="build.all-css.properties" />
</replace>
<!-- Copy over the contents of _diffs -->
<if>
<available file="@{dir}/_diffs" />
<then>
<copy todir="@{dir}" overwrite="true">
<fileset
dir="@{dir}/_diffs"
/>
</copy>
</then>
</if>
</sequential>
</for>
</target>
<target name="build-yui">
<subant target="all">
<fileset
dir="${project.dir}/lib/yui3/src"
excludes="build.xml"
includes="**/build.xml"
/>
</subant>
<antcall target="export-yui" />
<antcall target="copyright-yui" />
</target>
<target name="clean">
<antcall target="clean-module-src"/>
<antcall target="clean-skin-src"/>
</target>
<target name="clean-release">
<delete dir="${release.temp.dir}" />
<delete file="${project.dir}/${release.file.name}" />
</target>
<target name="init-yui">
<echo>Initializing YUI Library.</echo>
<antcall target="export-yui" />
<antcall target="copyright-yui" />
</target>
<target name="export-yui">
<echo>Copying files from [${project.dir}/lib/yui3/build] to [${project.dir}/build].</echo>
<copy todir="${project.dir}/build" overwrite="true">
<fileset dir="${project.dir}/lib/yui3/build">
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="copyright-yui">
<echo>Adding YUI Copyright information</echo>
<copy todir="${project.dir}/build" includeEmptyDirs="false" overwrite="true" encoding="UTF-8">
<fileset dir="${project.dir}/lib/yui3/build">
<or>
<filename name="**/*.css"/>
<filename name="**/*.js"/>
</or>
</fileset>
<filterchain>
<concatfilter prepend="${project.dir}/resources/builder/templates/yui-copyright.txt"/>
<replacetokens>
<token key="VERSION" value="${yui3.version}"/>
<token key="BUILD" value="${yui3.build.version}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="create-release">
<echo>Replacing @VERSION@ tokens</echo>
<replaceregexp match="@VERSION@" replace="${release.version}" flags="g" byline="true">
<fileset dir="${release.temp.dir}/build/" includes="**/aui-*.js"/>
</replaceregexp>
<echo>Creating Zip file ${release.name}.zip</echo>
<!-- I would just use "git archive" for this, but I couldn't find a decent way to add the version numbers
to the build files (also git archive will only export a commit, not the current working tree state,
which is something we use to test a change inside of Liferay) -->
<exec executable="git" dir="${project.dir}" outputproperty="release.comment" failifexecutionfails="false">
<arg value="log" />
<arg value="-1" />
<arg value="--format=SHA: %h on %cD" />
<arg value="HEAD" />
</exec>
<zip basedir="${release.temp.dir}" comment="${release.comment}" destfile="${project.dir}/${release.file.name}" />
<delete dir="${release.temp.dir}" />
</target>
<target name="release-full" depends="clean-release">
<copy todir="${release.temp.dir}">
<fileset dir="${project.dir}">
<include name="api/**" />
<include name="build/**" />
<include name="demos/**" />
<include name="lib/yui-combo/**" />
<include name="sandbox/**" />
<include name="*.txt" />
</fileset>
</copy>
<delete dir="${release.temp.dir}/sandbox/tags" />
<delete dir="${release.temp.dir}/sandbox/taglibs" />
<antcall target="create-release" />
</target>
<target name="release-minimal" depends="clean-release">
<copy todir="${release.temp.dir}">
<fileset dir="${project.dir}">
<include name="build/**" />
<include name="demos/**" />
<include name="*.txt" />
</fileset>
</copy>
<antcall target="create-release" />
</target>
<target name="release" depends="release-minimal,clean-release" />
<target name="remove-whitespace">
<echo>Removing trailing spaces of the source files.</echo>
<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
<fileset dir="${project.dir}/src/" includes="*.js"/>
</replaceregexp>
</target>
<!--
YUI Docs ant tasks
-->
<property name="project.name" value="Alloy UI" />
<property name="project.url" value="http://alloy.liferay.com/deploy/api" />
<property name="project.docs.dir" value="${project.dir}/resources/docs" />
<property name="yui.version" location="3.0.0" />
<property name="yuidoc.output.dir" location="${project.dir}/_api" />
<property name="yuidoc.home" location="${project.dir}/lib/yui-yuidoc" />
<property name="yuidoc.exec" location="${yuidoc.home}/bin/yuidoc.py" />
<property name="yuidoc.tmpdir" location="${project.docs.dir}/temp" />
<property name="yuidoc.parsein.dir" location="${project.dir}/build" />
<property name="yuidoc.template.dir" location="${project.docs.dir}/template" />
<target name="build-doc" depends="clean-doc">
<echo>Deleting old API files</echo>
<delete>
<fileset dir="${project.dir}/api" includes="**/*" />
</delete>
<mkdir dir="${yuidoc.tmpdir}" />
<mkdir dir="${yuidoc.tmpdir}/parsertmp" />
<echo>Generating ${project.name} Documentation</echo>
<var name="yuidoc.modules.list" value=""/>
<for param="dir">
<path>
<dirset
dir="${project.dir}/build"
includes="*"
/>
</path>
<sequential>
<var name="yuidoc.modules.list" value="@{dir} ${yuidoc.modules.list}"/>
</sequential>
</for>
<exec executable="${yuidoc.exec}">
<arg line="${yuidoc.modules.list}"/>
<arg value="-p"/>
<arg value="${yuidoc.tmpdir}/parsertmp"/>
<arg value="-o" />
<arg value="${yuidoc.output.dir}" />
<arg value="-t" />
<arg value="${yuidoc.template.dir}" />
<arg value="-m" />
<arg value="${project.name}" />
<arg value="-Y" />
<arg value="${yui.version}" />
<arg value="-v" />
<arg value="${release.version}" />
<arg value="-u" />
<arg value="${project.url}" />
</exec>
<copy todir="${project.dir}/api" overwrite="true">
<fileset dir="${project.dir}/_api" includes="**/*" />
</copy>
<echo>Removing Temp Built Files from ${yuidoc.tmpdir}</echo>
<delete dir="${yuidoc.tmpdir}" />
<delete dir="${project.dir}/_api" />
</target>
<target name="clean-doc" description="Clean out build">
<echo>Removing Documentation Built Files</echo>
<delete dir="${yuidoc.tmpdir}" />
<delete dir="${project.dir}/_api" />
</target>
</project>