-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.xml
622 lines (538 loc) · 23.8 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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
<?xml version="1.0" encoding="utf-8"?>
<project name="ext" default=".help">
<!--
The build-impl.xml file imported here contains the guts of the build process. It is
a great idea to read that file to understand how the process works, but it is best to
limit your changes to this file.
-->
<import file="${basedir}/.sencha/package/build-impl.xml"/>
<!--
The following targets can be provided to inject logic before and/or after key steps
of the build process:
The "init-local" target is used to initialize properties that may be personalized
for the local machine.
<target name="-before-init-local"/>
<target name="-after-init-local"/>
The "clean" target is used to clean build output from the build.dir.
<target name="-before-clean"/>
<target name="-after-clean"/>
The general "init" target is used to initialize all other properties, including
those provided by Sencha Cmd.
<target name="-before-init"/>
<target name="-after-init"/>
The "build" target performs the call to Sencha Cmd to build the application.
<target name="-before-build"/>
<target name="-after-build"/>
-->
<target name="-before-init">
<property name="pkg.excludes"
value="all-licenses/**/*,
examples/**/*,
welcome/**/*,
build/welcome/**/*,
build/classic/**/*,
build/modern/**/*,
build/packages/**/*,
build/index.html,
test/**/*,
classic/classic/test/**/*,
modern/modern/test/**/*,
release-notes-*,
build/temp/**/*,
build/examples/**/*,
ext-all*.js,
ext-debug.js,
ext.js,
ext-modern*.js,
classic/*/test/**/*,
modern/*/test/**/*,
packages/*/test/**/*,
test_internal/**/*,
bootstrap*.js"/>
<condition property="repo.dev.mode" value="true">
<available file="${basedir}/../attic" type="dir"/>
</condition>
</target>
<target name="-after-init" depends="apply-production-settings"/>
<macrodef name="x-set-license">
<attribute name="license" default="${ext.license.name}"/>
<attribute name="version" default="${build.version}"/>
<sequential>
<replaceregexp replace="ext.license.name=@{license}"
file="${basedir}/cmd/sencha.cfg" byline="true">
<regexp pattern="ext.license.name=(.*)"/>
</replaceregexp>
<replaceregexp replace="$ext-version: '@{version}'"
file="${package.dir}/classic/theme-base/sass/etc/all.scss">
<regexp pattern="\$ext-version: '(.*)'"/>
</replaceregexp>
<replaceregexp replace="$ext-version: '@{version}'"
file="${package.dir}/modern/theme-base/sass/etc/all.scss">
<regexp pattern="\$ext-version: '(.*)'"/>
</replaceregexp>
<local name="watermark.setting"/>
<condition property="watermark.beta.setting" value="$ext-beta: true !default;">
<equals arg1="@{license}" arg2="beta"/>
</condition>
<property name="watermark.beta.setting" value="$ext-beta: false !default;"/>
<condition property="watermark.setting" value="$ext-trial: true !default;">
<equals arg1="@{license}" arg2="trial"/>
</condition>
<property name="watermark.setting" value="$ext-trial: false !default;"/>
<replaceregexp replace="${watermark.setting}"
file="${package.dir}/classic/theme-base/sass/etc/all.scss">
<regexp pattern="\$ext-trial: (.*) !default;"/>
</replaceregexp>
<replaceregexp replace="${watermark.setting}"
file="${package.dir}/modern/theme-base/sass/etc/all.scss">
<regexp pattern="\$ext-trial: (.*) !default;"/>
</replaceregexp>
<replaceregexp replace="${watermark.beta.setting}"
file="${package.dir}/classic/theme-base/sass/etc/all.scss">
<regexp pattern="\$ext-beta: (.*) !default;"/>
</replaceregexp>
<replaceregexp replace="${watermark.beta.setting}"
file="${package.dir}/modern/theme-base/sass/etc/all.scss">
<regexp pattern="\$ext-beta: (.*) !default;"/>
</replaceregexp>
<if>
<available file="${basedir}/all-licenses/@{license}" type="dir"/>
<then>
<copy todir="${basedir}/licenses" overwrite="true">
<fileset dir="${basedir}/all-licenses/@{license}" includes="**/*"/>
</copy>
</then>
</if>
</sequential>
</macrodef>
<target name="beta" depends="init">
<x-set-license license="beta"/>
</target>
<target name="commercial" depends="init">
<x-set-license license="commercial"/>
</target>
<target name="gpl" depends="init">
<x-set-license license="gpl"/>
</target>
<target name="trial" depends="init">
<x-set-license license="trial"/>
</target>
<target name="dev" depends="init">
<x-set-license license="dev"/>
</target>
<target name="init-version-properties" if="repo.dev.mode">
<property name="build.number" value="12345"/>
<property name="version.major" value="6"/>
<property name="version.minor" value="0"/>
<property name="version.patch" value="0"/>
<property name="version.build" value="${build.number}"/>
<property name="version.release" value="${version.major}.${version.minor}.${version.patch}"/>
<property name="version.full" value="${version.release}.${version.build}"/>
<property name="ext.version.number" value="${version.full}"/>
<property name="ext.license.name" value="dev"/>
</target>
<target name="detect-git-hash" if="repo.dev.mode">
<x-git-current-hash property="git.current.hash"/>
</target>
<target name="generate-version-properties"
depends="detect-git-hash,init-version-properties"
if="repo.dev.mode">
<propertyfile file="${package.dir}/version.properties">
<entry operation="="
key="version.major"
value="${version.major}"/>
<entry operation="="
key="version.minor"
value="${version.minor}"/>
<entry operation="="
key="version.patch"
value="${version.patch}"/>
<entry operation="="
key="version.build"
value="${version.build}"/>
<entry operation="="
key="version.release"
value="${version.release}"/>
<entry operation="="
key="version.full"
value="${version.full}"/>
<entry operation="="
key="git.current.hash"
value="${git.current.hash}"/>
</propertyfile>
</target>
<target name="load-version-properties" depends="generate-version-properties">
<property file="${package.dir}/version.properties"/>
</target>
<target name="set-build-production">
<property name="build.production" value="1"/>
<replace file="${basedir}/package.json"
token=""local": true"
value=""local": false"/>
</target>
<target name="apply-production-settings" if="build.production">
<x-property-file file="${package.dir}/.sencha/package/sencha.cfg">
<entry type="string" key="skip.examples" operation="=" value="1"/>
</x-property-file>
</target>
<target name="copy-license" depends="init,load-version-properties">
<tstamp>
<!-- sets DSTAMP=yyyyMMdd, TSTAMP=hhmm -->
<format property="THIS_YEAR" pattern="yyyy"/>
<format property="tstamp.datetime" pattern="yyyy-MM-dd HH:mm:ss"/>
<format property="tstamp.pretty" pattern="MMMM d, yyyy"/>
</tstamp>
<property name="product.name" value="Ext JS ${package.version}"/>
<!--
Ext JS is distrubted under GPL and Commercial licenses as well as a Beta license.
This target allows the package build to be leveraged while swapping out the files
with license information.
-->
<condition property="ext.license"
value="${package.dir}/../all-licenses/${ext.license.name}">
<available file="${package.dir}/../all-licenses/${ext.license.name}" type="dir"/>
</condition>
<property name="ext.license" value="${package.licenses.dir}"/>
<echo> loading file-header.txt </echo>
<!-- Load the appropriate license file header -->
<local name="file-header"/>
<loadfile property="file-header" srcfile="${ext.license}/file-header.txt">
<filterchain>
<expandproperties/>
</filterchain>
</loadfile>
<echo> expanding file-header.txt </echo>
<copy file="${ext.license}/file-header.txt"
tofile="${package.licenses.dir}/file-header.txt.final"
overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<rename src="${package.licenses.dir}/file-header.txt.final"
dest="${package.licenses.dir}/file-header.txt"
replace="true"/>
<!--
Create a JS/CSS compatible file with header inside a "/* */" block.
-->
<echo file="${package.licenses.dir}/file-header.js"
message="/* ${file-header} */ "/>
<fixcrlf file="${package.licenses.dir}/file-header.js"/>
<!--
Copy in the appropriate license.txt file
-->
<mkdir dir="${package.licenses.dir}"/>
<copy file="${ext.license}/license.txt"
tofile="${package.licenses.dir}/license.txt.final"
overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<rename src="${package.licenses.dir}/license.txt.final"
dest="${package.licenses.dir}/license.txt"
replace="true"/>
<copy file="${package.licenses.dir}/license.txt"
tofile="${package.dir}/LICENSE" overwrite="true"/>
<!--
Lay down the file header so we can append the rest from the compiler.
-->
<for list="ext,ext-all,ext-all-rtl,ext-modern,ext-modern-all"
param="file">
<sequential>
<for list=".js,-debug.js" param="sfx">
<sequential>
<concat destfile="${build.dir}/@{file}@{sfx}.tmp" overwrite="true">
<fileset file="${package.licenses.dir}/file-header.js"/>
<fileset file="${build.dir}/@{file}@{sfx}"/>
</concat>
<delete>
<fileset file="${build.dir}/@{file}@{sfx}"/>
</delete>
<move file="${build.dir}/@{file}@{sfx}.tmp" tofile="${build.dir}/@{file}@{sfx}"/>
</sequential>
</for>
</sequential>
</for>
</target>
<target name="bootstrap-classic" depends="init"
description="Build Ext JS Bootstrap (Classic)">
<x-echo>=========================================</x-echo>
<x-echo>Building framework bootstrap (Classic)</x-echo>
<x-echo>=========================================</x-echo>
<x-sencha-command
dir="${package.dir}/classic/classic"
inheritall="false">
ant
bootstrap
</x-sencha-command>
</target>
<target name="bootstrap-modern" depends="init"
description="Build Ext JS Bootstrap (Modern)">
<x-echo>=========================================</x-echo>
<x-echo>Building framework bootstrap (Modern)</x-echo>
<x-echo>=========================================</x-echo>
<x-sencha-command
dir="${package.dir}/modern/modern"
inheritall="false">
ant
bootstrap
</x-sencha-command>
</target>
<target name="bootstrap" depends="bootstrap-classic,bootstrap-modern"
description="Build Ext JS Bootstrap"/>
<target name="build-examples-index">
<copy todir="${build.dir}/examples/" overwrite="true">
<fileset dir="${basedir}/examples/">
<include name="index.html"/>
<include name="main.css"/>
<include name="main.js"/>
<include name="examples.js"/>
</fileset>
</copy>
<copy todir="${build.dir}/examples/resources/" overwrite="true">
<fileset dir="${basedir}/examples/resources/" includes="**/*"/>
</copy>
</target>
<target name="build-non-app-examples">
<for param="example">
<dirset dir="${package.dir}/examples/classic" includes="*"/>
<sequential>
<if>
<not>
<available file="@{example}/app.json"/>
</not>
<then>
<local name="example.name"/>
<basename property="example.name" file="@{example}"/>
<copy todir="${build.dir}/examples/classic/${example.name}" overwrite="true">
<fileset dir="@{example}" includes="**/*"/>
</copy>
</then>
</if>
</sequential>
</for>
</target>
<target name="prep-build-folder" depends="init,build-examples-index,build-non-app-examples">
<copy todir="${build.dir}/welcome" overwrite="true">
<fileset dir="${basedir}/welcome"/>
</copy>
<copy file="${basedir}/index.html"
tofile="${build.dir}/index.html"
overwrite="true"/>
<replace file="${build.dir}/index.html"
token="build/examples/classic/index.html"
value="examples/classic/index.html"/>
<replace file="${build.dir}/examples/classic/shared/include-ext.js"
token="Ext.devMode = 2;"
value="Ext.devMode = 0;"/>
<replace file="${build.dir}/examples/classic/shared/include-ext.js"
token="Ext.devMode = 1;"
value="Ext.devMode = 0;"/>
</target>
<target name="-before-pkg" depends="init,copy-license">
<if>
<available file="${basedir}/release-notes.html"/>
<then>
<copy file="${basedir}/release-notes.html"
tofile="${build.dir}/release-notes.html"
overwrite="true"/>
</then>
</if>
</target>
<!--
******************************************************************
Targets to easily run builds for specific items
******************************************************************
-->
<target name="build-classic"
description="Build the Classic Theme (needed by unit tests)"
depends="init">
<x-sencha-command dir="${package.dir}/classic/theme-classic" inheritall="false">
package
build
</x-sencha-command>
</target>
<target name="build-crisp"
description="Build the Crisp Theme"
depends="init">
<x-sencha-command dir="${package.dir}/classic/theme-crisp" inheritall="false">
package
build
</x-sencha-command>
</target>
<target name="build-gray"
description="Build the Gray Theme"
depends="init">
<x-sencha-command dir="${package.dir}/classic/theme-gray" inheritall="false">
package
build
</x-sencha-command>
</target>
<target name="build-neptune"
description="Build the Neptune Theme"
depends="init">
<x-sencha-command dir="${package.dir}/classic/theme-neptune" inheritall="false">
package
build
</x-sencha-command>
</target>
<target name="build-triton"
description="Build the Triton Theme"
depends="init">
<x-sencha-command dir="${package.dir}/classic/theme-triton" inheritall="false">
package
build
</x-sencha-command>
</target>
<target name="themes"
description="Build all theme packages"
depends="build-neptune,build-crisp,build-triton,build-classic,build-gray"/>
<!--
******************************************************************
Targets used to produce deployment builds
******************************************************************
-->
<target name="docs" depends="init" description="Builds docs for Ext JS and sub-packages">
<mkdir dir="${package.build.dir}/docs"/>
<exec executable="jsduck">
<arg value="--output=${package.build.dir}/docs"/>
<arg value="--config=${package.dir}/docs/config.json"/>
</exec>
</target>
<!-- FIXME core should be the only package here, but we still have dependencies in the examples -->
<property name="static.packages" value="core,amf,charts,soap"/>
<target name="zip-impl" depends="init">
<property name="staging.dir" value="${workspace.dir}/staging"/>
<property name="display.version" value="${package.version}"/>
<property name="folder.display.version" value="${display.version}"/>
<property name="zip.display.version" value="${display.version}"/>
<property name="ext.staging.dir" value="${staging.dir}/${package.name}-${folder.display.version}"/>
<property name="ext.zip" value="${pkg.build.dir}/${package.name}-${zip.display.version}-${ext.license.name}.zip"/>
<delete dir="${staging.dir}"/>
<delete file="${ext.zip}"/>
<mkdir dir="${ext.staging.dir}"/>
<unzip src="${pkg.build.dir}/${pkg.file.name}" dest="${ext.staging.dir}"/>
<copy todir="${ext.staging.dir}">
<fileset dir="${package.dir}" includes="examples/**/*,build/examples/**/*"/>
</copy>
<copy todir="${ext.staging.dir}">
<fileset dir="${package.dir}" includes="examples/**/*,build/examples/**/*"/>
</copy>
<if>
<equals arg1="${repo.dev.mode}" arg2="true"/>
<then>
<copy todir="${ext.staging.dir}/.sencha/workspace">
<fileset dir="${package.dir}/../deployment_workspace"
includes="**/*"/>
</copy>
</then>
</if>
<copy todir="${ext.staging.dir}">
<fileset dir="${package.dir}"
includes="welcome/**/*,
build/**/*,
packages/core/test/specs*/**/*,
packages/core/test/resources/**/*,
packages/charts/test/specs*/**/*,
classic/classic/test/*.*,
classic/classic/test/resources/**/*,
classic/classic/test/local/**/*,
classic/classic/test/specs*/**/*,
modern/modern/test/*.*,
modern/modern/test/local/**/*,
modern/modern/test/specs*/**/*"/>
</copy>
<delete dir="${ext.staging.dir}/build/temp"/>
<delete dir="${ext.staging.dir}/build/ext"/>
<replace file="${ext.staging.dir}/examples/classic/shared/include-ext.js"
token="Ext.devMode = 2;"
value="Ext.devMode = 1;"/>
<zip destfile="${ext.zip}" basedir="${staging.dir}" level="9"/>
</target>
<target name="zip" depends="set-build-production,build,prep-build-folder,zip-impl"
description="Build package and create distribution ZIP file">
</target>
<target name="sass-rebuild" depends="init" if="false">
<x-process-sub-packages>
<x-sub-build dir="@{pkg-dir}"
target="sass"
inherit-version="${build.subpkgs.inherit.version}"/>
</x-process-sub-packages>
<x-process-examples>
<x-sencha-command dir="@{example-dir}" inheritall="false">
app
each
ant
sass
</x-sencha-command>
</x-process-examples>
</target>
<target name="quick-build" depends="init,js,prep-build-folder,pkg"/>
<target name="zip-only" depends="quick-build,zip-impl">
</target>
<macrodef name="x-sandbox">
<attribute name="file"/>
<attribute name="outfile" default="@{file}"/>
<attribute name="jsPrefix"/>
<attribute name="cssPrefix"/>
<sequential>
<concat destfile="@{outfile}">
<header trimleading="yes" filtering="no">
(function(Ext) {
Ext.sandboxName = '@{jsPrefix}';
Ext.isSandboxed = true;
Ext.buildSettings = { baseCSSPrefix: "@{cssPrefix}", scopeResetCSS: true };
</header>
<filelist files="@{file}"/>
<footer trimleading="yes" filtering="no">
})(this.@{jsPrefix} || (this.@{jsPrefix} = {}));
</footer>
</concat>
</sequential>
</macrodef>
<target name="-after-build">
<for list="ext-all,ext-all-rtl,ext-modern-all" param="file">
<sequential>
<for list=".js,-debug.js" param="sfx">
<sequential>
<x-sandbox file="${build.dir}/@{file}@{sfx}"
outfile="${build.dir}/@{file}-sandbox@{sfx}"
jsPrefix="Ext6"
cssPrefix="x6-"/>
</sequential>
</for>
</sequential>
</for>
</target>
<!--
******************************************************************
Targets for Test
******************************************************************
-->
<!--
<target name="test-ext" depends="bootstrap,build-classic,test-run"/>
<target name="test-all" depends="test-ext"/>
<target name="coverage-run" depends="init">
<x-sencha-command dir="${package.dir}">
<![CDATA[
config
-prop
cmd-test.specs.test-json=${package.dir}/test/specs/coverageTest.json
-prop
cmd-test.coverage.results.dir=${workspace.dir}/test/coverage-results
then
package
test
run
]]>
</x-sencha-command>
</target>
<target name="coverage-report" depends="init">
<x-shell dir="${workspace.dir}/test">
node istanbul_report.js ${workspace.dir}/test/coverage-results ${workspace.dir}
</x-shell>
</target>
<target name="coverage" depends="coverage-run,coverage-report"/>
-->
</project>