forked from JxLib/JxLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
446 lines (356 loc) · 19.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
<?xml version="1.0" encoding="UTF-8"?>
<!--*************************************************************************
Filename : build.xml
Project : jx
Document Type : XML
Purpose : build file for ant tool
Author Date Description
M.Adair 09-July-2007 initial version copied from fusion
$Id$
***************************************************************************-->
<project basedir="." default="deploy" name="jx">
<!-- ===================== Property Definitions =========================== -->
<!--
Each of the following properties are used in the build script.
Values for these properties are set by the first place they are
defined, from the following list:
* Definitions on the "ant" command line (ant -Dfoo=bar compile).
* Definitions from a "build.properties" file in the top level
source directory of this application.
* Definitions from a "build.properties" file in the developer's
home directory.
* Default definitions in this build.xml file.
You will note below that property values can be composed based on the
contents of previously defined properties. This is a powerful technique
that helps you minimize the number of changes required when your development
environment is modified. Note that property composition is allowed within
"build.properties" files as well as in the "build.xml" script.
-->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<property file="default.properties"/>
<!-- ==================== File and Directory Names ======================== -->
<!--
These properties generally define file and directory names (or paths) that
affect where the build process stores its outputs.
app.name Base name of this application, used to
construct filenames and directories.
Defaults to "myapp".
app.path Context path to which this application should be
deployed (defaults to "/" plus the value of the
"app.name" property).
app.version Version number of this iteration of the application.
build.home The directory into which the "prepare" and
"compile" targets will generate their output.
Defaults to "build".
dist.home The name of the base directory in which
distribution files are created.
Defaults to "dist".
deploy.home The name of the directory to deploy the library to.
Defaults to the web site directory (../www).
docs.home The name of the directory to deploy the api docs to.
Defaults to the reference directory within the web
site directory (../www).
-->
<property environment="env"/>
<property name="app.name" value="jxlib"/>
<property name="app.path" value="/${app.name}"/>
<property name="app.version" value="3.0"/>
<!-- when branching jxlib, modify build.xml in the branch to set the
correct jxlib.home value (add an extra ../) -->
<property name="jxlib.home" value="${basedir}"/>
<property name="build.home" value="${jxlib.home}/build"/>
<property name="dist.home" value="${jxlib.home}/dist"/>
<property name="deploy.home" value="${jxlib.home}/www"/>
<property name="docs.home" value="${jxlib.home}/www/reference"/>
<property name="vendor.home" value="${jxlib.home}/vendor"/>
<!-- ==================== External Dependencies =========================== -->
<!--
Use property values to define the locations of external libraries on which
your application will depend.
YUIcompressor - we include a working version in the utils dir that comes with
the source
NaturalDocs - the api reference docs are built automagically from source using
natural docs, we've included it in utils since we are dependent
on a particular version
MooToolsCore - the mootools core file to use. We include a full build of mootools
but you can replace it with your own minimal build if you like.
MooToolsMore - the mootools more file to use. We include a full build of mootools
but you can replace it with your own minimal build if you like.
-->
<property name="YUIcompressor" value="${basedir}/utils/yuicompressor-2.3.6.jar"/>
<property name="NaturalDocs" value="${basedir}/utils/NaturalDocs-1.4/NaturalDocs"/>
<property name="MooToolsCore" value="${basedir}/utils/mootools-1.2.2-core-nc.js" />
<property name="MooToolsMore" value="${basedir}/utils/mootools-1.2.2.1-more.js" />
<!-- ==================== Prepare Target ================================== -->
<!--
The "prepare" target is used to create the "build" destination directory,
and copy the static contents of your web application to it. If you need
to copy static files from external dependencies, you can customize the
contents of this task.
Normally, this task is executed indirectly when needed.
-->
<target name="prepare" description="preparing core files" depends="clean">
<echo message="os name=${os.name}"/>
<echo message="os family=${osfamily}"/>
<echo message="Preparing core files"/>
<!-- Create build directories as needed -->
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/lib"/>
<!-- Copy static content of the project -->
<copy todir="${build.home}">
<fileset dir="${basedir}/src" includes="Source/** themes/** images/**"/>
</copy>
<delete file="${build.home}/lib/jxlib.uncompressed.js"/>
<delete file="${build.home}/lib/jxlib.standalone.uncompressed.js"/>
<delete file="${build.home}/lib/jxlib.js"/>
<delete file="${build.home}/lib/jxlib.standalone.js"/>
<echo message="Concatenating javascript into jxlib"/>
<echo message="exec 1"/>
<exec executable="php">
<arg line="${basedir}/utils/combine.php -filelist ${build.home}/Source/scripts.json -jsonFile ${build.home}/lib/jxlib.json -target ${build.home}/lib/jxlib.temp.js -basedir ${build.home}/Source" />
</exec>
<echo message="exec 2"/>
<exec executable="php">
<arg line="${basedir}/utils/combine.php -filelist ${vendor.home}/mootools-core/current/Source/scripts.json -jsonFile ${build.home}/lib/core.json -target ${build.home}/lib/mootools-core.js -basedir ${vendor.home}/mootools-core/current/Source" />
</exec>
<echo message="exec 3"/>
<exec executable="php">
<arg line="${basedir}/utils/combine.php -filelist ${vendor.home}/mootools-more/current/Source/scripts.json -jsonFile ${build.home}/lib/more.json -target ${build.home}/lib/mootools-more.js -basedir ${vendor.home}/mootools-more/current/Source" />
</exec>
<echo message="exec 4"/>
<exec executable="php">
<arg line="${basedir}/utils/createDeps.json.php -fileLoc ${build.home}/lib" />
</exec>
<exec executable="php">
<arg line="${basedir}/utils/combineFiles.php -filelist mootools-core,mootools-more,jxlib.temp -target ${build.home}/lib/jxlib.uncompressed.js -basedir ${build.home}/lib" />
</exec>
<exec executable="php">
<arg line="${basedir}/utils/combineFiles.php -filelist ../Source/license,jxlib.uncompressed -target ${build.home}/lib/jxlib.uncompressed.js -basedir ${build.home}/lib" />
</exec>
<exec executable="php">
<arg line="${basedir}/utils/combineFiles.php -filelist ../Source/license,jxlib.temp -target ${build.home}/lib/jxlib.standalone.uncompressed.js -basedir ${build.home}/lib" />
</exec>
<java jar="${YUIcompressor}" fork="true"
output="${build.home}/lib/jxlib.standalone.compressed.js">
<arg value="${build.home}/lib/jxlib.standalone.uncompressed.js"/>
</java>
<java jar="${YUIcompressor}" fork="true"
output="${build.home}/lib/jxlib.compressed.js">
<arg value="${build.home}/lib/jxlib.uncompressed.js"/>
</java>
<exec executable="php">
<arg line="${basedir}/utils/combineFiles.php -filelist ../Source/license,jxlib.standalone.compressed -target ${build.home}/lib/jxlib.standalone.js -basedir ${build.home}/lib" />
</exec>
<exec executable="php">
<arg line="${basedir}/utils/combineFiles.php -filelist ../Source/license,jxlib.compressed -target ${build.home}/lib/jxlib.js -basedir ${build.home}/lib" />
</exec>
<replace file="${build.home}/lib/jxlib.standalone.uncompressed.js" token="[version]" value="${app.version}"/>
<replace file="${build.home}/lib/jxlib.standalone.js" token="[version]" value="${app.version}"/>
<replace file="${build.home}/lib/jxlib.uncompressed.js" token="[version]" value="${app.version}"/>
<replace file="${build.home}/lib/jxlib.js" token="[version]" value="${app.version}"/>
<delete file="${build.home}/lib/jxlib.standalone.compressed.js"/>
<delete file="${build.home}/lib/jxlib.compressed.js"/>
<delete file="${build.home}/lib/jxlib.temp.js"/>
<copy file="${build.home}/images/a_pixel.png" todir="${build.home}/lib"/>
<mkdir dir="${build.home}/themes"/>
</target>
<target name="theme" description="create a theme based on the theme variable">
<echo message="Creating ${theme} theme"/>
<mkdir dir="${build.home}/lib/themes/${theme}"/>
<copy file="${build.home}/themes/${theme}/ie6.css" todir="${build.home}/lib/themes/${theme}/"/>
<copy file="${build.home}/themes/${theme}/ie7.css" todir="${build.home}/lib/themes/${theme}/"/>
<concat destfile="${build.home}/lib/themes/${theme}/jxtheme.uncompressed.css">
<filelist dir="${build.home}/themes/${theme}" files="reset.css"/>
<fileset dir="${build.home}/themes/${theme}/css" includes="**.css"/>
</concat>
<copy todir="${build.home}/lib/themes/${theme}/images">
<fileset dir="${build.home}/themes/${theme}/images"/>
</copy>
<java jar="${YUIcompressor}" fork="true"
output="${build.home}/lib/themes/${theme}/jxtheme.compressed.css">
<arg value="${build.home}/lib/themes/${theme}/jxtheme.uncompressed.css"/>
</java>
<concat destfile="${build.home}/lib/themes/${theme}/jxtheme.css">
<filelist dir="${build.home}/themes/${theme}" files="license.css"/>
<filelist dir="${build.home}/lib/themes/${theme}" files="jxtheme.compressed.css"/>
</concat>
<delete file="${build.home}/lib/themes/${theme}/jxtheme.compressed.css"/>
</target>
<!-- =================== Compress Target ================================== -->
<target description="Build the Jx library" name="build" depends="prepare">
<antcall target="theme">
<param name="theme" value="crispin"/>
</antcall>
<antcall target="theme">
<param name="theme" value="delicious"/>
</antcall>
</target>
<target description="Copies JxLib files to www directory" name="copy" depends="build" >
<copy todir="${deploy.home}/lib">
<fileset dir="${build.home}/lib"/>
</copy>
</target>
<target description="Deploy JxLib" name="deploy" depends="copy,builder,tests,docs">
<echo message="deploying files"/>
<copy todir="${deploy.home}/reference/tutorials/lib">
<fileset dir="${build.home}/lib"/>
</copy>
<copy todir="${deploy.home}/reference/examples/lib">
<fileset dir="${build.home}/lib"/>
</copy>
</target>
<target description="Deploy source for www download builder" name="builder" depends="copy">
<delete dir="${deploy.home}/builder/src" />
<delete dir="${deploy.home}/builder/assets" />
<mkdir dir="${deploy.home}/builder/src"/>
<mkdir dir="${deploy.home}/builder/assets"/>
<mkdir dir="${deploy.home}/builder/assets/themes"/>
<mkdir dir="${deploy.home}/builder/src/core"/>
<mkdir dir="${deploy.home}/builder/src/more"/>
<mkdir dir="${deploy.home}/builder/src/core/Source"/>
<mkdir dir="${deploy.home}/builder/src/more/Source"/>
<mkdir dir="${deploy.home}/builder/src/jxlib"/>
<mkdir dir="${deploy.home}/builder/src/jxlib/Source"/>
<copy todir="${deploy.home}/builder/src/core/Source">
<fileset dir="${vendor.home}/mootools-core/current/Source" />
</copy>
<copy todir="${deploy.home}/builder/src/more/Source">
<fileset dir="${vendor.home}/mootools-more/current/Source" />
</copy>
<copy todir="${deploy.home}/builder/src/jxlib/Source/">
<fileset dir="${build.home}/Source" />
</copy>
<copy todir="${deploy.home}/builder/assets/themes/">
<fileset dir="${build.home}/lib/themes/" />
</copy>
<!-- Copy all theme files to the builder/src directory -->
<copy file="${build.home}/images/a_pixel.png" todir="${deploy.home}/builder/assets" />
<copy todir="${deploy.home}/builder/src/jxlib/themes/">
<fileset dir="${build.home}/themes/" />
</copy>
<!-- Place JSON files -->
<move file="${build.home}/lib/deps.json" todir="${deploy.home}/builder/work/" />
<move file="${build.home}/lib/jxlib.json" todir="${deploy.home}/builder" />
<move file="${build.home}/lib/core.json" todir="${deploy.home}/builder" />
<move file="${build.home}/lib/more.json" todir="${deploy.home}/builder" />
</target>
<target description="setup files for tests" name="tests" depends="builder">
<!-- Copy themes to the right locations -->
<copy todir="${basedir}/tests/interactive/UserTests/assets/themes">
<fileset dir="${build.home}/lib/themes/"/>
</copy>
<copy file="${build.home}/lib/a_pixel.png" todir="${basedir}/tests/interactive/UserTests/assets/" />
<delete dir="${deploy.home}/tests" />
<mkdir dir="${deploy.home}/tests"/>
<copy todir="${deploy.home}/tests">
<fileset dir="${basedir}/tests" />
</copy>
<delete file="${deploy.home}/tests/interactive/config.js"/>
<rename dest="${deploy.home}/tests/interactive/config.js" src="${deploy.home}/tests/interactive/config-www.js"/>
<delete file="${deploy.home}/tests/interactive/test_frame.html"/>
<rename dest="${deploy.home}/tests/interactive/test_frame.html" src="${deploy.home}/tests/interactive/test_frame-www.html"/>
</target>
<target description="Package Tutorials" name="tutorials" depends="build">
<echo message="packaging tutorials"/>
<mkdir dir="${build.home}/tutorials"/>
<copy todir="${build.home}/tutorials/lib">
<fileset dir="${build.home}/lib"/>
</copy>
<copy todir="${build.home}/tutorials/browsr">
<fileset dir="${deploy.home}/reference/tutorials/browsr"/>
</copy>
</target>
<target description="Package Examples" name="examples" depends="build">
<echo message="packaging examples"/>
<mkdir dir="${build.home}/examples"/>
<copy todir="${build.home}/examples">
<fileset dir="${deploy.home}/reference/examples"/>
</copy>
</target>
<!-- ==================== Documentation =================================== -->
<target description="Create documentation" name="docs" depends="prepare">
<mkdir dir="${build.home}/docs"/>
<mkdir dir="${build.home}/docs/api"/>
<echo message="Generating documentation"/>
<exec executable="cmd" os="Windows Vista, Windows XP" dir="${build.home}">
<arg line="/c perl ${NaturalDocs} -i ./Source -o framedhtml ./docs/api -p ${basedir}/utils/ndconfig -s jx -r"/>
</exec>
<exec executable="/usr/bin/env" os="Mac OS X, Linux" dir="${build.home}">
<arg line=" perl ${NaturalDocs} -i ./Source -o framedhtml ./docs/api -p ${basedir}/utils/ndconfig -s jx -r"/>
</exec>
<mkdir dir="${docs.home}/api"/>
<copy todir="${docs.home}/api">
<fileset dir="${build.home}/docs/api"/>
</copy>
</target>
<!-- ==================== Dist Target ===================================== -->
<!--
The "dist" target creates a binary distribution of your application
in a directory structure ready to be archived in a tar.gz or zip file.
Note that this target depends on two others:
* "compile" so that the entire web application (including external
dependencies) will have been assembled
-->
<target name="dist" description="Create binary distribution" depends="clean,build,tutorials,examples">
<echo message="Creating distribution archives"/>
<mkdir dir="${dist.home}"/>
<delete file="${dist.home}/${app.name}-${app.version}.tar.gz"/>
<delete file="${dist.home}/${app.name}-tutorials-${app.version}.tar.gz"/>
<delete file="${dist.home}/${app.name}-examples-${app.version}.tar.gz"/>
<delete file="${dist.home}/${app.name}-${app.version}.zip"/>
<delete file="${dist.home}/${app.name}-tutorials-${app.version}.zip"/>
<delete file="${dist.home}/${app.name}-examples-${app.version}.zip"/>
<!-- Create source zip file -->
<zip destfile="${dist.home}/${app.name}-${app.version}.zip" update="true">
<zipfileset dir="${build.home}/lib" prefix="${app.name}"/>
</zip>
<!-- Create tutorials zip file -->
<zip destfile="${dist.home}/${app.name}-tutorials-${app.version}.zip" update="true">
<zipfileset dir="${build.home}/tutorials" prefix="${app.name}"/>
</zip>
<!-- Create examples zip file -->
<zip destfile="${dist.home}/${app.name}-examples-${app.version}.zip" update="true">
<zipfileset dir="${build.home}/examples" prefix="${app.name}"/>
</zip>
<!-- create tar file -->
<tar destfile="${dist.home}/${app.name}-${app.version}.tar">
<tarfileset dir="${build.home}/lib" prefix="${app.name}"/>
</tar>
<gzip src="${dist.home}/${app.name}-${app.version}.tar" destfile="${dist.home}/${app.name}-${app.version}.tar.gz"/>
<delete file="${dist.home}/${app.name}-${app.version}.tar"/>
<!-- create tar file -->
<tar destfile="${dist.home}/${app.name}-tutorials-${app.version}.tar">
<tarfileset dir="${build.home}/tutorials" prefix="${app.name}"/>
</tar>
<gzip src="${dist.home}/${app.name}-tutorials-${app.version}.tar" destfile="${dist.home}/${app.name}-tutorials-${app.version}.tar.gz"/>
<delete file="${dist.home}/${app.name}-tutorials-${app.version}.tar"/>
<!-- create tar file -->
<tar destfile="${dist.home}/${app.name}-examples-${app.version}.tar">
<tarfileset dir="${build.home}/examples" prefix="${app.name}"/>
</tar>
<gzip src="${dist.home}/${app.name}-examples-${app.version}.tar" destfile="${dist.home}/${app.name}-examples-${app.version}.tar.gz"/>
<delete file="${dist.home}/${app.name}-examples-${app.version}.tar"/>
</target>
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target description="clean up areas that we copy files to including dist and build directories" name="clean">
<echo message="Removing build directories"/>
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
<delete dir="${docs.home}/api" />
<delete dir="${basedir}/tests/interactive/UserTests/assets/themes" />
<delete dir="${deploy.home}/tests" />
<delete dir="${deploy.home}/builder/src" />
<delete dir="${deploy.home}/builder/assets" />
<delete dir="${deploy.home}/reference/tutorials/lib" />
<delete dir="${deploy.home}/reference/examples/lib" />
<delete dir="${deploy.home}/lib" />
<mkdir dir="${deploy.home}/lib" />
<copy file="${basedir}/tests/empty.html" todir="${deploy.home}/lib" />
<delete dir="${jxlib.home}/utils/ndconfig/Data" />
</target>
</project>