13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<?xml version="1.0" encoding="utf-8"?>
<!--
********************************** DO NOT EDIT **********************************
 
This file will be replaced during upgrades so DO NOT EDIT this file. If you need to
adjust the process, reading and understanding this file is the first step.
 
In most cases, the adjustments can be achieved by setting properties or providing one
of the "hooks" in the form of a "-before-" or "-after-" target. Whenever possible, look
for one of these solutions.
 
Failing that, you can copy whole targets to your build.xml file and it will overrride
the target provided here. Doing that can create problems for upgrading to newer
versions of Cmd so it is not recommended but it will be easier to manage than editing
this file in most cases.
-->
<project>
    <!--
    Init-Local
    -->
    <target name="-before-init-local"/>
    <target name="-init-local">
        <property file="${basedir}/../../local.properties"/>
 
        <script language="javascript">
            var f = new java.io.File(project.getProperty("basedir"));
            var sub = ".sencha/workspace/sencha.cfg";
 
            for (var p = f; p; p = p.getParentFile()) {
                var t = new java.io.File(p, sub);
                if (t.exists()) {
                    // we found the workspace folder!
 
                    t = new java.io.File(p, "local.properties");
                    if (t.exists()) {
                        var loader = project.createTask("property");
                        loader.setFile(new java.io.File(t.getCanonicalPath()));
                        loader.execute();
                    }
 
                    break;
                }
            }
        </script>
 
    </target>
    <target name="-after-init-local"/>
    <target name="init-local"
            depends="-before-init-local,-init-local,-after-init-local"/>
 
    <!--
    Find Sencha Cmd
    -->
    <target name="find-cmd" unless="cmd.dir">
        <!--
        Run "sencha which" to find the Sencha Cmd basedir and get "cmd.dir" setup. We
        need to execute the command with curdir set properly for Cmd to pick up that we
        are running for an application.
        -->
        <exec executable="sencha" dir="${basedir}">
            <arg value="which"/><arg value="-o=$cmddir$"/>
        </exec>
 
        <!-- Now read the generated properties file and delete it -->
        <property file="$cmddir$"/>
        <delete file="$cmddir$"/>
 
        <echo>Using Sencha Cmd from ${cmd.dir}</echo>
    </target>
 
    <!--
    Init
    -->
    <target name="-before-init"/>
    <target name="-init">
        <taskdef resource="com/sencha/ant/antlib.xml" 
                 classpath="${cmd.dir}/sencha.jar"
                 loaderref="senchaloader"/>
        <x-sencha-init prefix=""/>
        
        <!-- default the build environment to production if it is unset by this point -->
        <property name="args.environment" value="production"/>
        <property name="CR" value="&#10;"/>
        
        <x-load-properties file="${app.config.dir}/${args.environment}.properties" required="0"/>
        <x-load-properties file="${app.config.dir}/build.properties" required="1"/>
        
        <if>
            <x-is-true value="${build.compression.yui}"/>
            <then>
                <property name="build.compression" value="-yui"/>
            </then>
            <else>
                <if>
                    <x-is-true value="${build.compression.closure}"/>
                    <then>
                        <property name="build.compression" value="-closure"/>
                    </then>
                    <else>
                        <if>
                            <x-is-true value="${build.compression.uglify}"/>
                             <then>
                                <property name="build.compression" value="-uglify"/>
                             </then>
                             <else>
                                <property name="build.compression" value=""/>
                             </else>
                        </if>
                    </else>
                </if>
            </else>
        </if>
        
        <x-normalize-path path="${build.dir}/resources" property="image.search.path"/>
                        
        <if>
            <isset property="app.theme"/>
            <then>
                <property name="build.theme.commands">
                    and
                    union
                        -not
                        -tag=core
                    and
                    metadata
                        +append
                        --base-path=${bootstrap.base.path}
                        +loader-paths
                        -jsonp=Ext.Loader.addClassPathMappings
                        -out=${bootstrap.example.js}
                    and
                    exclude
                        -tag=framework
                    and
                    include
                        -namespace=Ext.ux
                    and
                    metadata
                        --base-path=${bootstrap.base.path}
                        +alternates
                        +append
                        -out=${bootstrap.example.js}
                    and
                    metadata
                        --base-path=${bootstrap.base.path}
                        +alias
                        +append
                        -out=${bootstrap.example.js}
                    and
                    union
                        -tag=packageOverrides
                    and
                    metadata
                        --base-path=${bootstrap.base.path}
                        +append
                        +filenames
                        -tpl=Ext.Loader.loadScript("{0}");
                        -out=${bootstrap.example.js}
 
                # sass
 
                    and
                    restore
                        page
                    and
                    #only set variables for used classes eg. $include-class-name
                    sass
                        +class-name-vars
                        -variable=$image-search-path:'${image.search.path}'
                        -variable=$theme-name: '${app.theme}' !default
                        -output=${app.out.scss}
                    and
                    include
                        -all
                    and
                    sass
                        +class-name-vars
                        +etc
                        +vars
                        +rules
                        -variable=$image-search-path:'${image.search.path}'
                        -variable=$theme-name: '${app.theme}' !default
                        -output=${app.example.scss}
                    and
                    # include etc and vars from all classes
                    sass
                        +etc
                        +vars
                        +append
                        -output=${app.out.scss}
                    and
                    restore
                        page
                    and
                    #only include rules from used classes
                    sass
                        +rules
                        +append
                        -output=${app.out.scss}
                    and
                    sass
                        +ruby
                        -output=${app.out.ruby}
                </property>
            </then>
            <else>
                <property name="build.theme.commands" value=""/>
                <property name="skip.sass" value="true"/>
                <property name="skip.slice" value="true"/>
            </else>
        </if>
 
        
        <!-- Some operations require sencha.jar in the Ant classpath -->
        <x-extend-classpath>
            <jar path="${cmd.dir}/sencha.jar"/>
        </x-extend-classpath>
        
        <x-verify-app-cmd-ver/>
       
    </target>
    <target name="-after-init"/>
 
    <target name="-before-init-default"/>
    <target name="-init-default">
        <!--
             This property can be modified to change general build options
             such as excluding files from the set.  The format expects newlines
             for each argument, for example:
             
             <property name="build.operations"/>
                   exclude
                       -namespace=Ext
             </property>
        -->
        <property name="build.operations" value=""/>
        
        <!--
             This property can be modified to change concatenation
             specific options
             
             -strip-comments: comment suppression
             -remove-text-references: transform string literal class references to objects
             -beautify: unpack the source
             
             <property name="build.concat.options"/>
                    -strip-comments
                    -remove-text-references
                    -beautify
             </property>
        -->
        <property name="build.concat.options" value=""/>
        
        <!--
             This property can be modified to change page compilation options
             
             -scripts: inject the given script path into the generated markup ahead of the all classes file
             
             <property name="build.page.options"/>
                    -scripts=framework.js
             </property>
        -->
        <property name="build.page.options" value=""/>
    </target>
    <target name="-after-init-default"/>
    
    <target name="init"
            depends="init-local,find-cmd,-before-init,-init,-after-init,-before-init-default,-init-default,-after-init-default"/>
    
    <!--
    Clean
    -->
    <target name="-before-clean"/>
    <target name="-clean">
        <delete dir="${build.dir}"/>
    </target>
    <target name="-after-clean"/>
    <target name="clean"
            depends="init,-before-clean,-clean,-after-clean"
            description="Removes all build output produced by the 'build' target"/>
 
    <!--
    Build SASS
    -->
    <target name="-before-sass"/>
    <target name="-sass">
        <x-compass-compile
            dir="${build.dir}"
            trace="true"
            boring="true"
            force="true"
            sassdir="${compass.sass.dir}"
            cssdir="${compass.css.dir}"
            config="${compass.config.file}"/>
 
        <macrodef name="x-compress-css-files">
            <attribute name="dir"/>
            <attribute name="prefix"/>
            <attribute name="outprefix"/>
            <attribute name="compress"/>
            <attribute name="preprocess"/>
            <sequential>
                <x-split-css file="@{dir}/@{prefix}.css"
                             outdir="${build.resources.dir}"
                             limit="${build.css.selector.limit}"/>
 
                <for param="cssfile">
                    <fileset dir="@{dir}" includes="@{prefix}*.css"/>
                    <sequential>
                        <local name="css.output.name"/>
                        <local name="pattern"/>
                        <property name="pattern" value="(.*?)(@{prefix})(_\d{1,2})*\.css"/>
                        <propertyregex property="css.output.name"
                                       input="@{cssfile}"
                                       regexp="${pattern}"
                                       select="\1@{outprefix}\3.css"
                                       override="true"/>
                        <if>
                            <equals arg1="@{preprocess}" arg2="true"/>
                            <then>
                                <echo>Preprocessing @{cssfile} to ${css.output.name}</echo>
                                <x-css-preprocess 
                                    file="@{cssfile}" 
                                    tofile="${css.output.name}" 
                                    options="${build.css.preprocessor.opts}"/>
                            </then>
                        </if>
                        <if>
                            <equals arg1="@{compress}" arg2="true"/>
                            <then>
                                <echo>Compressing @{cssfile} to ${css.output.name}</echo>
                                <x-compress-css srcfile="@{cssfile}"
                                                outfile="${css.output.name}"/>
                            </then>
                        </if>
                    </sequential>
                </for>
            </sequential>
        </macrodef>
 
        <x-compress-css-files dir="${build.dir}/resources"
                              prefix="${app.out.base.debug}"
                              outprefix="${app.out.base}"
                              preprocess="${build.css.preprocess}"
                              compress="${build.css.compress}"/>
                
        <!--
        app.out.css.path is relative to the app output index.html file
        -->
        <x-get-relative-path
            from="${app.dir}"
            to="${app.out.css}"
            property="app.out.css.path"
            />
 
        <x-get-relative-path
            from="${app.example.dir}"
            to="${app.example.css}"
            property="app.example.css.path"
            />
        
<!--update the application's bootstrap.css file to point to the build output-->
 
<echo file="${app.bootstrap.css}">
/*
 * This file is generated by Sencha Cmd and should NOT be edited. It redirects
 * to the most recently built CSS file for the application to allow index.html
 * in the development directory to load properly (i.e., "dev mode").
 */
@import '${app.out.css.path}';
</echo>
 
<!--update the app's example to point to the build output-->
<echo file="${app.example.dir}/example.css">
/*
 * This file is generated by Sencha Cmd and should NOT be edited. It redirects
 * to the most recently built CSS file for the application to allow theme.html
 * to load properly for image slicing (required to support non-CSS3 browsers
 * such as IE9 and below).
 */
@import '${app.example.css.path}';
</echo>
                
    </target>
    <target name="-after-sass"/>
    <target name="sass" depends="init" unless="skip.sass"
            description="Builds only the SASS files using Compass">
        <antcall target="-before-sass"/>
        <antcall target="-sass"/>
        <antcall target="-after-sass"/>
    </target>
 
    <!--
    Inherit Resources
    -->
    <target name="-before-inherit-resources"/>
    <target name="-after-inherit-resources"/>
    <target name="inherit-resources" depends="init"
            description="Performs the resource folder inheritance from base theme(s)">
        <antcall target="-before-inherit-resources"/>
 
        <if>
            <isset property="theme.base.packages"/>
            <then>
                <for list="${theme.base.packages}" param="base">
                    <sequential>
                        <echo>Merging resources from base package @{base}</echo>
                        <local name="base.path"/>
                        <local name="base.resource.path"/>
                        <property name="base.path" location="@{base}"/>
                        <property name="base.resource.path" location="${base.path}/resources"/>
                        
                        <if>
                            <available file="${base.resource.path}" type="dir" />
                            <then>
                                <copy todir="${build.resources.dir}" overwrite="true">
                                    <fileset 
                                        dir="${base.resource.path}" 
                                        includes="**/*"
                                        excludes="@{base}-all*.css"/>
                                </copy>
                            </then>
                        </if>
                    </sequential>
                </for>
            </then>
        </if>
 
        <if>
            <isset property="app.requires.packages"/>
            <then>
                <for list="${app.requires.packages}" param="base">
                    <sequential>
                        <echo>Copying resources from required package @{base}</echo>
                        <local name="base.path"/>
                        <local name="base.resource.path"/>
                        <property name="base.path" location="@{base}"/>
                        <property name="base.resource.path" location="${base.path}/resources"/>
                        
                        <if>
                            <available file="${base.resource.path}" type="dir" />
                            <then>
                                <copy todir="${build.resources.dir}/@{base}" overwrite="true">
                                    <fileset 
                                        dir="${base.resource.path}" 
                                        includes="**/*"
                                        excludes="@{base}-all*.css"/>
                                </copy>
                            </then>
                        </if>
                    </sequential>
                </for>
            </then>
        </if>
 
        <antcall target="-after-inherit-resources"/>
    </target>
    
    <!--
    Slice
    -->
    <target name="-before-slice"/>
    <target name="-after-slice"/>
    <target name="slice" depends="init" unless="skip.slice"
            description="Slices CSS3 theme to produce non-CSS3 images and sprites">
        <antcall target="-before-slice"/>
 
        <echo>Capture theme image to ${build.capture.png}</echo>
        <x-sencha-command>
            theme
                capture
                    -page=${app.example.theme.html}
                    -image=${build.capture.png}
                    -manifest=${build.capture.json}
        </x-sencha-command>
 
        <echo>Slicing theme images to ${build.resources.dir}</echo>
        <x-sencha-command>
            fs
                slice
                    ${build.slice.options}
                    -image=${build.capture.png}
                    -manifest=${build.capture.json}
                    -out=${build.resources.dir}
        </x-sencha-command>
 
        <antcall target="-after-slice"/>
    </target>
    
    <!--
    Copy Resources
    -->
    <target name="-before-copy-resources"/>
    <target name="-after-copy-resources"/>
    <target name="copy-resources" depends="init"
            description="Copy theme resources to folder">
        <antcall target="-before-copy-resources"/>
 
        <if>
            <available file="${build.resources.dir}"/>
            <then>
                <copy todir="${build.resources.dir}" overwrite="true">
                    <fileset 
                        dir="${app.resources.dir}" 
                        includes="**/*" 
                        excludes="**/Readme.md"/>
                </copy>
            </then>
        </if>
        
        <antcall target="-after-copy-resources"/>
    </target>
    
    <!--
    Refresh Individual Theme
    -->
    <target name="-before-refresh-theme"/>
    <target name="-refresh-theme">
        <echo>Executing 'sencha package build' for theme package ${args.themeName}</echo>
        <x-sencha-command 
            dir="${workspace.theme.dir}"
            inheritAll="false">
            <property name="cmd.dir" value="${cmd.dir}"/>
            package
            build
        </x-sencha-command>
    </target>
    <target name="-after-refresh-theme"/>
    <target name="refresh-theme" depends="init" unless="skip.theme"
            description="Executes 'sencha package build' for the specified theme package name">
        <antcall target="-before-refresh-theme"/>
        <antcall target="-refresh-theme"/>
        <antcall target="-after-refresh-theme"/>
    </target>
 
    <!--
    Build Page
    -->
    <target name="-before-page"/>
    <target name="-page">
        
<echo file="${bootstrap.example.js}">
/**
 * This file is generated by Sencha Cmd and should NOT be edited.  It is 
 * provided to support globbing requires, custom xtypes, and other 
 * metadata-driven class system features 
 */
</echo>
 
        <!--run compile command to generate concatenated output files for js and scss-->
        <x-sencha-command dir="${app.dir}">
            # base build command
            
            compile
                -options=${build.options}
                page
                    -name=full-page
                    -in=${app.page.file}
                    -out=${build.page.file}
                    -classes=${build.classes.name}
                    -stylesheet=${app.out.css.rel}  
                    ${build.page.options}
                and
                restore
                    full-page     
                and
                ${build.operations}
                and
                ${build.optimize}
                and
                save
                    page
            
            # page command
 
                and
                concat
                    ${build.compression}
                    -out=${build.classes.file}
                    ${build.concat.options}
 
            # bootstrap
             ${build.theme.commands}
            
        </x-sencha-command>
    </target>
    <target name="-after-page"/>
    <target name="page" depends="init" unless="skip.page"
            description="Builds only the application's HTML page">
        <antcall target="-before-page"/>
        <antcall target="-page"/>
        <antcall target="-after-page"/>
    </target>
 
 
    <!--
    Build
    -->
    <target name="-before-build"/>
    <target name="-build" depends="page,inherit-resources,copy-resources,sass,slice"/>
    <target name="-after-build"/>
    <target name="build"
            depends="init,-before-build,-build,-after-build"
            description="Builds the application"/>
 
    <!--
    environment setters
    -->
 
    <target name="production">
        <property name="args.environment" value="production"/>
    </target>
 
    <target name="testing">
        <property name="args.environment" value="testing"/>
    </target>
 
    <target name="native">
        <property name="args.environment" value="native"/>
    </target>
 
    <target name="package">
        <property name="args.environment" value="package"/>
    </target>
    
    <!--
    Helpful targets
    -->
    <target name=".props" depends="init"
            description="Lists all properties defined for the build">
        <echoproperties/>
    </target>
 
    <target name=".help" depends="init"
            description="Provides help on the build script">
        <x-get-project-targets property="help.message"/>
 
        <echo><![CDATA[${help.message}
This is the main build script for your application.
 
The following properties can be used to disable certain steps in the build
process.
 
 * skip.page        Do not build the HTML page.
 * skip.sass        Do not build the SASS.
 * skip.theme       Do not build the theme images.
            
The following properties can be used to modify the build process.
            
 * build.compression.yui                Specify yui compression for the build
 
 * build.compression.closure            Specify closure compression for the build
            
 * build.compression.uglify             Specify uglify compression for the build
            
 * build.options                        Set general options for the build
                                        (eg: enable a debug build)
 
         To modify any of the previous build specific options, see:
           ${basedir}/.sencha/app/${args.environment}.properties
            
 * build.operations                     Insert commands into the compile command
                                        for the build.
            
 * app.page.name                        Set the input and output page file
                                        for the compile command.
 
 * build.classes.name                   Specify the compiled js file
                                        
 
For details about how these options affect your build, see
 
    ${basedir}/.sencha/app/build-impl.xml
 
These options can be stored in a local.properties file in this folder or in the
local.properties file in the workspace.
 
Alternatively, these can be supplied on the command line. For example:
 
    ant -Dskip.sass=1 build
 
To see all currently defined properties, do this:
 
    ant .props
        ]]></echo>
    </target>
 
</project>