forked from highcharts/highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1326 lines (1235 loc) · 73.3 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
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
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<!-- Highcharts build file -->
<project name="build" default="usage" xmlns:ac="antlib:net.sf.antcontrib">
<!-- Describes the usage of the build file by invoking -projecthelp. -->
<target name="usage">
<java classname="org.apache.tools.ant.Main">
<arg value="-projecthelp"/>
<arg value="-quiet"/>
</java>
</target>
<!-- Sets various properties needed during the build. -->
<target name="set.properties">
<!-- Read the release names and versions for our products. -->
<property file="build.properties"/>
<filterset id="highcharts.filter">
<filter token="product.name" value="${highcharts.product.name}"/>
<filter token="product.cdnpath" value="${highcharts.product.cdnpath}"/>
<filter token="product.version" value="${highcharts.product.version}"/>
<filter token="product.date" value="${highcharts.product.date}"/>
</filterset>
<filterset id="highstock.filter">
<filter token="product.name" value="${highstock.product.name}"/>
<filter token="product.cdnpath" value="${highstock.product.cdnpath}"/>
<filter token="product.version" value="${highstock.product.version}"/>
<filter token="product.date" value="${highstock.product.date}"/>
</filterset>
<!-- folder names -->
<property name="tools.dir" value="${basedir}/tools"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="testoutput.dir" value="${build.dir}/tests"/>
<property name="coveragereport.dir" value="${build.dir}/coverage-report"/>
<property name="themes.dir" value="${basedir}/js/themes"/>
<!-- highcharts/highstock src -->
<property name="highcharts.parts.dir" location="${basedir}/js/parts"/>
<property name="highchartsmore.parts.dir" location="${basedir}/js/parts-more"/>
<property name="highcharts.src.name" value="highcharts.src.js"/>
<property name="highcharts.src.file" value="${basedir}/js/${highcharts.src.name}"/>
<property name="highcharts.minified.name" value="highcharts.js"/>
<property name="highstock.src.name" value="highstock.src.js"/>
<property name="highstock.src.file" value="${basedir}/js/${highstock.src.name}"/>
<property name="highstock.minified.name" value="highstock.js"/>
<property name="highchartsmore.src.name" value="highcharts-more.src.js"/>
<property name="highchartsmore.src.file" value="${basedir}/js/${highchartsmore.src.name}"/>
<property name="highchartsmore.minified.name" value="highcharts-more.js"/>
<property name="mootools.src.name" value="mootools-adapter.src.js"/>
<property name="prototype.src.name" value="prototype-adapter.src.js"/>
<property name="standalone.src.name" value="standalone-framework.src.js"/>
<property name="exporting.src.name" value="exporting.src.js"/>
<property name="data.src.name" value="data.src.js"/>
<property name="drilldown.src.name" value="drilldown.src.js"/>
<property name="funnel.src.name" value="funnel.src.js"/>
<property name="nodata.src.name" value="no-data-to-display.src.js"/>
<property name="map.src.name" value="map.src.js"/>
<property name="heatmap.src.name" value="heatmap.src.js"/>
<property name="annotations.src.name" value="annotations.src.js"/>
<property name="mootools.minified.name" value="mootools-adapter.js"/>
<property name="prototype.minified.name" value="prototype-adapter.js"/>
<property name="standalone.minified.name" value="standalone-framework.js"/>
<property name="exporting.minified.name" value="exporting.js"/>
<property name="data.minified.name" value="data.js"/>
<property name="drilldown.minified.name" value="drilldown.js"/>
<property name="funnel.minified.name" value="funnel.js"/>
<property name="nodata.minified.name" value="no-data-to-display.js"/>
<property name="map.minified.name" value="map.js"/>
<property name="heatmap.minified.name" value="heatmap.js"/>
<property name="annotations.minified.name" value="annotations.js"/>
<property name="mootools.src.file" value="${basedir}/js/adapters/${mootools.src.name}"/>
<property name="prototype.src.file" value="${basedir}/js/adapters/${prototype.src.name}"/>
<property name="standalone.src.file" value="${basedir}/js/adapters/${standalone.src.name}"/>
<property name="exporting.src.file" value="${basedir}/js/modules/${exporting.src.name}"/>
<property name="data.src.file" value="${basedir}/js/modules/${data.src.name}"/>
<property name="drilldown.src.file" value="${basedir}/js/modules/${drilldown.src.name}"/>
<property name="funnel.src.file" value="${basedir}/js/modules/${funnel.src.name}"/>
<property name="nodata.src.file" value="${basedir}/js/modules/${nodata.src.name}"/>
<property name="map.src.file" value="${basedir}/js/modules/${map.src.name}"/>
<property name="heatmap.src.file" value="${basedir}/js/modules/${heatmap.src.name}"/>
<property name="annotations.src.file" value="${basedir}/js/modules/${annotations.src.name}"/>
<property name="highcharts-all.minified.name" value="highcharts-all.js"/>
<!-- jsLint -->
<property name="jslint4java.dir" value="${tools.dir}/jslint4java"/>
<property name="jslint4java.jar" value="${jslint4java.dir}/jslint4java-2.0.0.jar"/>
<taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="${jslint4java.jar}"/>
<!-- google closure compiler -->
<property name="gcc.dir" value="${tools.dir}/google-closure-compiler"/>
<property name="gcc.jar" location="${gcc.dir}/compiler.jar"/>
<!-- YUI compressor -->
<property name="yuicomp.dir" value="${tools.dir}/yui-compressor"/>
<property name="yuicomp.jar" location="${yuicomp.dir}/yuicompressor-2.4.6.jar"/>
<property name="yuicomp.output.name" value="highcharts.min-yui.js"/>
<!-- google js-test-driver -->
<property name="jstestdriver.dir" value="${tools.dir}/js-test-driver"/>
<property name="jstestdriver.jar" location="${jstestdriver.dir}/JsTestDriver-1.3.5.jar"/>
<!-- ant-contrib -->
<property name="ant.contrib.dir" value="${tools.dir}/ant-contrib-0.6-bin"/>
<property name="ant.contrib.jar" location="${ant.contrib.dir}/lib/ant-contrib-0.6.jar"/>
<taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpath="${ant.contrib.jar}"/>
<!-- cache-control Amamzon S3 -->
<tstamp>
<format property="http.expires.five.years" pattern="E, dd MMM yyyy hh:mm:ss" locale="en,US" offset="1825"/>
</tstamp>
<tstamp>
<format property="http.expires.one.month" pattern="E, dd MMM yyyy hh:mm:ss" locale="en,US" offset="31"/>
</tstamp>
<tstamp>
<format property="http.expires.one.day" pattern="E, dd MMM yyyy hh:mm:ss" locale="en,US" offset="1"/>
</tstamp>
<property name="max.age.five.years" value="157680000"/>
<property name="max.age.one.month" value="2592001"/>
<property name="max.age.one.day" value="86400"/>
<!-- This is the list of files for highcharts -->
<filelist id="highcharts.files" dir="${highcharts.parts.dir}">
<file name="Intro.js"/>
<file name="Globals.js"/>
<file name="Utilities.js"/>
<file name="PathAnimation.js"/>
<file name="JQueryAdapter.js"/>
<file name="Adapters.js"/>
<file name="Options.js"/>
<file name="Color.js"/>
<file name="SvgRenderer.js"/>
<file name="Html.js"/>
<file name="VmlRenderer.js"/>
<file name="CanVGRenderer.js"/>
<file name="Tick.js"/>
<file name="PlotLineOrBand.js"/>
<file name="Axis.js"/>
<file name="LogarithmicAxis.js"/>
<file name="DateTimeAxis.js"/>
<file name="StackItem.js"/>
<file name="Tooltip.js"/>
<file name="Pointer.js"/>
<file name="MSPointer.js"/>
<file name="Legend.js"/>
<file name="Chart.js"/>
<file name="CenteredSeriesMixin.js"/>
<file name="Point.js"/>
<file name="Series.js"/>
<file name="Dynamics.js"/>
<file name="LineSeries.js"/>
<file name="AreaSeries.js"/>
<file name="SplineSeries.js"/>
<file name="AreaSplineSeries.js"/>
<file name="ColumnSeries.js"/>
<file name="BarSeries.js"/>
<file name="ScatterSeries.js"/>
<file name="PieSeries.js"/>
<file name="Datalabels.js"/>
<file name="Facade.js"/>
<file name="Outro.js"/>
</filelist>
<!-- This is the list of files for highstock -->
<filelist id="highstock.files" dir="${highcharts.parts.dir}">
<file name="Intro.js"/>
<file name="Globals.js"/>
<file name="Utilities.js"/>
<file name="PathAnimation.js"/>
<file name="JQueryAdapter.js"/>
<file name="Adapters.js"/>
<file name="Options.js"/>
<file name="Color.js"/>
<file name="SvgRenderer.js"/>
<file name="Html.js"/>
<file name="VmlRenderer.js"/>
<file name="CanVGRenderer.js"/>
<file name="Tick.js"/>
<file name="StackItem.js"/>
<file name="PlotLineOrBand.js"/>
<file name="Axis.js"/>
<file name="DateTimeAxis.js"/>
<file name="LogarithmicAxis.js"/>
<file name="Tooltip.js"/>
<file name="Pointer.js"/>
<file name="MSPointer.js"/>
<file name="Legend.js"/>
<file name="Chart.js"/>
<file name="CenteredSeriesMixin.js"/>
<file name="Point.js"/>
<file name="Series.js"/>
<file name="Dynamics.js"/>
<file name="LineSeries.js"/>
<file name="AreaSeries.js"/>
<file name="SplineSeries.js"/>
<file name="AreaSplineSeries.js"/>
<file name="ColumnSeries.js"/>
<file name="BarSeries.js"/>
<file name="ScatterSeries.js"/>
<file name="PieSeries.js"/>
<file name="DataLabels.js"/>
<!-- Stock -->
<file name="OrdinalAxis.js"/>
<file name="DataGrouping.js"/>
<file name="OHLCSeries.js"/>
<file name="CandlestickSeries.js"/>
<file name="FlagsSeries.js"/>
<file name="Scroller.js"/>
<file name="RangeSelector.js"/>
<file name="StockNavigation.js"/>
<file name="StockChart.js"/>
<file name="Facade.js"/>
<file name="Outro.js"/>
</filelist>
<!-- This is the list of files for highcharts-more -->
<filelist id="highchartsmore.files" dir="${highchartsmore.parts.dir}">
<file name="Intro.js"/>
<file name="Globals.js"/>
<file name="Pane.js"/>
<file name="RadialAxis.js"/>
<file name="AreaRangeSeries.js"/>
<file name="AreaSplineRangeSeries.js"/>
<file name="ColumnRangeSeries.js"/>
<file name="GaugeSeries.js"/>
<file name="BoxPlotSeries.js"/>
<file name="ErrorBarSeries.js"/>
<file name="WaterfallSeries.js"/>
<file name="BubbleSeries.js"/>
<file name="Polar.js"/>
<file name="Outro.js"/>
</filelist>
<filelist id="highcharts-all.files" dir="${dist.dir}">
<file name="js/adapters/${standalone.minified.name}"/>
<file name="highcharts/js/${highcharts.minified.name}"/>
<file name="highcharts/js/${highchartsmore.minified.name}"/>
<file name="js/modules/${exporting.minified.name}"/>
<file name="js/modules/${data.minified.name}"/>
</filelist>
</target>
<!-- Set up a clean build folder. -->
<target name="clean" depends="set.properties">
<mkdir dir="${build.dir}"/>
<delete includeemptydirs="true">
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
<mkdir dir="${dist.dir}/js/adapters"/>
<mkdir dir="${dist.dir}/js/modules"/>
<mkdir dir="${dist.dir}/highcharts/gfx"/>
<mkdir dir="${dist.dir}/highcharts/js/adapters"/>
<mkdir dir="${dist.dir}/highcharts/js/modules"/>
<mkdir dir="${dist.dir}/highstock/gfx"/>
<mkdir dir="${dist.dir}/highstock/js/adapters"/>
<mkdir dir="${dist.dir}/highstock/js/modules"/>
<mkdir dir="${testoutput.dir}"/>
<mkdir dir="${coveragereport.dir}"/>
<delete file="${basedir}/jsTestDriver.conf" failonerror="false"/>
<delete file="${basedir}/jsTestDriverCoverage.conf" failonerror="false"/>
</target>
<!-- Assembles the source parts into one file. -->
<target name="assemble" depends="clean">
<!-- Concat highcharts src and replace the product name and version -->
<concat destfile="${highcharts.src.file}" encoding="UTF-8">
<filelist refid="highcharts.files"/>
<filterchain>
<replacetokens>
<token key="product.name" value="${highcharts.product.name}"/>
<token key="product.cdnpath" value="${highcharts.product.cdnpath}"/>
<token key="product.version" value="${highcharts.product.version}"/>
<token key="product.date" value="${highcharts.product.date}"/>
</replacetokens>
</filterchain>
</concat>
<!-- Concat highstock src and replace the product name and version -->
<concat destfile="${highstock.src.file}" encoding="UTF-8">
<filelist refid="highstock.files"/>
<filterchain>
<replacetokens>
<token key="product.name" value="${highstock.product.name}"/>
<token key="product.cdnpath" value="${highstock.product.cdnpath}"/>
<token key="product.version" value="${highstock.product.version}"/>
<token key="product.date" value="${highstock.product.date}"/>
</replacetokens>
</filterchain>
</concat>
<!-- Concat highcharts-more src and replace the product name and version -->
<concat destfile="${highchartsmore.src.file}" encoding="UTF-8">
<filelist refid="highchartsmore.files"/>
<filterchain>
<replacetokens>
<token key="product.name" value="${highcharts.product.name}"/>
<token key="product.cdnpath" value="${highcharts.product.cdnpath}"/>
<token key="product.version" value="${highcharts.product.version}"/>
<token key="product.date" value="${highcharts.product.date}"/>
</replacetokens>
</filterchain>
</concat>
<!-- Concat canvg library together with rgbcolor script -->
<concat destfile="build/canvas-tools.src.js">
<filelist dir="lib/canvg-1.1/" files="rgbcolor.js, canvg.js"/>
<filelist dir="js/modules/" files="canvgrenderer-extended.src.js"/>
</concat>
</target>
<!-- This target convert any mixed line endings to crlf. -->
<target name="check-crlf" depends="assemble">
<fixcrlf srcDir="${basedir}/js" includes="**/*.js" encoding="UTF-8" fixlast="false"/>
<fixcrlf srcDir="${basedir}/test" includes="**/*.js" encoding="UTF-8" fixlast="false"/>
</target>
<!-- Set a property that tells if there are nbsp. -->
<!--
<target name="do-check-nbsp">
<condition property="has.nbsp">
<resourcecontains resource="${highstock.src.file}" substring=""/>
</condition>
</target>
<target name="check-nbsp" depends="do-check-nbsp" if="has.nbsp">
<echo message="ERROR: Non-breaking space characters exist in source code."/>
</target>
-->
<!-- Runs jslint on generated source code. -->
<target name="do-lint" depends="check-crlf">
<jslint haltOnFailure="false" options="sloppy, forin, confusion, plusplus, nomen, vars, regexp, newcap, browser, undef, continue" encoding="UTF-8">
<formatter type="plain"/>
<formatter type="report" destfile="${build.dir}/lintreport.html"/>
<fileset file="${highstock.src.file}"/>
<fileset file="${highchartsmore.src.file}"/>
<fileset file="${mootools.src.file}"/>
<fileset file="${prototype.src.file}"/>
<fileset file="${standalone.src.file}"/>
<fileset file="${exporting.src.file}"/>
<fileset file="${data.src.file}"/>
<fileset file="${drilldown.src.file}"/>
<fileset file="${funnel.src.file}"/>
<fileset file="${nodata.src.file}"/>
<fileset file="${map.src.file}"/>
<fileset file="${heatmap.src.file}"/>
<fileset file="${annotations.src.file}"/>
<fileset dir="${themes.dir}"/>
<fileset file="js/modules/canvgrenderer-extended.src.js"/>
</jslint>
<!-- Set a property that tells if there are unused variables. -->
<condition property="lint.variable.error">
<or>
<resourcecontains resource="${build.dir}/lintreport.html" substring="Undefined variable"/>
<resourcecontains resource="${build.dir}/lintreport.html" substring="Unused variable"/>
</or>
</condition>
</target>
<!-- This target is only run if there are unused variables. -->
<target name="lint" depends="do-lint" if="lint.variable.error">
<echo message="Warning: undefined or unused variables exist. Run 'start build/lintreport.html'."/>
</target>
<!-- Runs jslint on parts in order to make it easier to find the error by file and line number. -->
<target name="do-lint-parts" depends="set.properties">
<jslint haltOnFailure="false" options="sloppy, forin, confusion, plusplus, nomen, vars, regexp, newcap, browser, undef, continue">
<formatter type="plain"/>
<formatter type="report" destfile="${build.dir}/lintreport.html"/>
<fileset dir="${highcharts.parts.dir}">
<include name="*.js"/>
<exclude name="Intro.js"/>
<exclude name="Outro.js"/>
</fileset>
<fileset dir="${highchartsmore.parts.dir}">
<include name="*.js"/>
<exclude name="Intro.js"/>
<exclude name="Outro.js"/>
</fileset>
</jslint>
<!-- Set a property that tells if there are unused variables. -->
<condition property="lint.parts.variable.error">
<resourcecontains resource="${build.dir}/lintreport.html" substring="Unused variable"/>
</condition>
<echo message="General warning: This target won't reveal undefined variables. Run 'ant lint' in addition."/>
</target>
<!-- This target is only run if there are unused variables. -->
<target name="lint-parts" depends="do-lint-parts" if="lint.parts.variable.error">
<echo message="Warning: Unused variables exist. Run 'start build/lintreport.html', search for 'Unused'."/>
</target>
<!-- Runs google closure compiler and yui compressor on src. -->
<target name="compile">
<!-- This command sets the logging level in current task to only include echo messages. -->
<script language="javascript">project.getBuildListeners().firstElement().setMessageOutputLevel(1);</script>
<echo message="Minifying ${param.src}"/>
<java jar="${gcc.jar}" fork="true">
<arg value="--compilation_level"/>
<arg value="SIMPLE_OPTIMIZATIONS"/>
<arg value="--js"/>
<arg value="${param.src}"/>
<arg value="--js_output_file"/>
<arg value="${param.out}"/>
<arg value="--charset"/>
<arg value="UTF-8"/>
</java>
<java jar="${yuicomp.jar}" fork="true">
<arg value="--type"/>
<arg value="js"/>
<arg value="-o"/>
<arg value="${param.out}.yui-min.js"/>
<arg value="--charset"/>
<arg value="UTF-8"/>
<arg value="${param.src}"/>
</java>
<length file="${param.src}" property="input.length"/>
<length file="${param.out}" property="gcc.output.length"/>
<!-- Create a temporary zipfile to get the zipped size -->
<copy file="${param.out}" tofile="${build.dir}/zipme.js"/>
<zip destfile="${build.dir}/zipped.zip" basedir="${build.dir}" includes="zipme.js"/>
<length file="${build.dir}/zipped.zip" property="zipped.output.length"/>
<length file="${param.out}.yui-min.js" property="yuicomp.output.length"/>
<!-- Create a temporary zipfile to get the zipped size -->
<copy file="${param.out}.yui-min.js" tofile="${build.dir}/yuizipme.js"/>
<zip destfile="${build.dir}/yuizipped.zip" basedir="${build.dir}" includes="yuizipme.js"/>
<length file="${build.dir}/yuizipped.zip" property="yui.zipped.output.length"/>
<!-- We are not distributing this file, its only used to make sure compilation works. -->
<delete file="${param.out}.yui-min.js" quiet="true"/>
<echo message="Google Closure compiler: ${input.length} bytes -> ${gcc.output.length} bytes (${zipped.output.length} bytes zipped)."/>
<echo message="Yahoo YUI Compressor: ${input.length} bytes -> ${yuicomp.output.length} bytes (${yui.zipped.output.length} bytes zipped)."/>
<echo message=""/>
</target>
<!-- Runs minifiers on source code. -->
<target name="minify" depends="assemble">
<antcall target="compile">
<param name="param.src" value="${highcharts.src.file}"/>
<param name="param.out" value="${dist.dir}/highcharts/js/${highcharts.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${highstock.src.file}"/>
<param name="param.out" value="${dist.dir}/highstock/js/${highstock.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${highchartsmore.src.file}"/>
<param name="param.out" value="${dist.dir}/highcharts/js/${highchartsmore.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${highchartsmore.src.file}"/>
<param name="param.out" value="${dist.dir}/highstock/js/${highchartsmore.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${mootools.src.file}"/>
<param name="param.out" value="${dist.dir}/js/adapters/${mootools.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${prototype.src.file}"/>
<param name="param.out" value="${dist.dir}/js/adapters/${prototype.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${standalone.src.file}"/>
<param name="param.out" value="${dist.dir}/js/adapters/${standalone.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${exporting.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${exporting.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${data.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${data.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${drilldown.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${drilldown.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${funnel.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${funnel.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${nodata.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${nodata.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${map.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${map.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${heatmap.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${heatmap.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="${annotations.src.file}"/>
<param name="param.out" value="${dist.dir}/js/modules/${annotations.minified.name}"/>
</antcall>
<antcall target="compile">
<param name="param.src" value="build/canvas-tools.src.js"/>
<param name="param.out" value="build/canvas-tools.js"/>
</antcall>
<!-- Concatenate a single file with minified standalone adapter and highcharts sources -->
<!-- for faster download from cloud.highcharts.com -->
<concat destfile="${dist.dir}/highcharts/js/${highcharts-all.minified.name}">
<filelist refid="highcharts-all.files"/>
<filterchain>
<replacetokens>
<token key="product.name" value="${highcharts.product.name}"/>
<token key="product.cdnpath" value="${highcharts.product.cdnpath}"/>
<token key="product.version" value="${highcharts.product.version}"/>
<token key="product.date" value="${highcharts.product.date}"/>
</replacetokens>
</filterchain>
</concat>
</target>
<!-- Builds the source and runts lint and minify. -->
<target name="build" depends="lint, minify" description="Builds the source and runs jsLint and minify."></target>
<scriptdef name="listfiles" language="javascript">
<![CDATA[
var dir = project.getProperty("samples.dir");
var fs = project.createDataType("fileset");
fs.setDir(new java.io.File(dir));
fs.setIncludes("**/demo.js");
// Get the files (array) of that fileset
var ds = fs.getDirectoryScanner(project);
var demoFiles = ds.getIncludedFiles();
// get the values via Java API
var basedir = fs.getDir(project);
// Iterate over the demo files
for (i = 0; i < demoFiles.length; i++) {
var filename = demoFiles[i];
var file = new java.io.File(basedir, filename);
project.setProperty('demo.name', file.getParentFile().getName());
project.setProperty('demo.html.name', file.getParent() + '/demo.html');
project.setProperty('demo.js.name', file.getParent() + '/demo.js');
project.executeTarget('create-sample');
}
]]>
</scriptdef>
<target name="create-sample">
<antcall target="create-sample-param"/>
</target>
<target name="create-sample-param">
<!-- Load the two demo files into properties -->
<loadfile property="demo.js" srcFile="${demo.js.name}"/>
<loadfile property="demo.html" srcFile="${demo.html.name}"/>
<!-- Copy the template file and replace the properties -->
<copy file="samples/template-example.htm" tofile="${samples.dist.dir}/examples/${demo.name}/index.htm">
<filterchain>
<replacetokens>
<token key="demo.title" value="${demo.title}"/>
<token key="demo.js" value="${demo.js}"/>
<token key="demo.html" value="${demo.html}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="create-samples">
<listfiles></listfiles>
</target>
<!-- Builds the source and assembles a distribution package. -->
<target name="dist" depends="build" description="Builds the source and assembles distribution packages.">
<echo message=""/>
<echo message="--- Building distribution packages for ---"/>
<echo message=""/>
<echo message=" ${highcharts.product.name} - ${highcharts.product.version} (${highcharts.product.date})"/>
<echo message=" ${highstock.product.name} - ${highstock.product.version} (${highstock.product.date})"/>
<echo message=""/>
<!-- 1. Check for any console statements -->
<!-- fail message="Source contains console or alert statements">
<condition>
<or>
<resourcecontains resource="${highcharts.src.file}" substring="console."/>
<resourcecontains resource="${highstock.src.file}" substring="console."/>
<resourcecontains resource="${mootools.src.file}" substring="console."/>
<resourcecontains resource="${prototype.src.file}" substring="console."/>
<resourcecontains resource="${exporting.src.file}" substring="console."/>
<resourcecontains resource="${highcharts.src.file}" substring="alert("/>
<resourcecontains resource="${highstock.src.file}" substring="alert("/>
<resourcecontains resource="${mootools.src.file}" substring="alert("/>
<resourcecontains resource="${prototype.src.file}" substring="alert("/>
<resourcecontains resource="${exporting.src.file}" substring="alert("/>
</or>
</condition>
</fail -->
<echo file="${dist.dir}/products.js" append="false">var products = {'Highcharts': {date: '${highcharts.product.date}', nr: '${highcharts.product.version}'},'Highstock': {date: '${highstock.product.date}', nr: '${highstock.product.version}'}};</echo>
<!-- 2. Copy highcharts source and minified versions, adapters, modules, themes. Replace product and version at the same time -->
<copy file="${highcharts.src.file}" todir="${dist.dir}/highcharts/js"><filterset refid="highcharts.filter"/></copy>
<copy file="${highstock.src.file}" todir="${dist.dir}/highstock/js"><filterset refid="highstock.filter"/></copy>
<copy file="${highchartsmore.src.file}" todir="${dist.dir}/highcharts/js"><filterset refid="highcharts.filter"/></copy>
<copy file="${highchartsmore.src.file}" todir="${dist.dir}/highstock/js"><filterset refid="highcharts.filter"/></copy>
<copy file="${mootools.src.file}" todir="${dist.dir}/highcharts/js/adapters"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/adapters/${mootools.minified.name}" todir="${dist.dir}/highcharts/js/adapters"><filterset refid="highcharts.filter"/></copy>
<copy file="${mootools.src.file}" todir="${dist.dir}/highstock/js/adapters"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/adapters/${mootools.minified.name}" todir="${dist.dir}/highstock/js/adapters"><filterset refid="highstock.filter"/></copy>
<copy file="${prototype.src.file}" todir="${dist.dir}/highcharts/js/adapters"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/adapters/${prototype.minified.name}" todir="${dist.dir}/highcharts/js/adapters"><filterset refid="highcharts.filter"/></copy>
<copy file="${prototype.src.file}" todir="${dist.dir}/highstock/js/adapters"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/adapters/${prototype.minified.name}" todir="${dist.dir}/highstock/js/adapters"><filterset refid="highstock.filter"/></copy>
<copy file="${standalone.src.file}" todir="${dist.dir}/highcharts/js/adapters"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/adapters/${standalone.minified.name}" todir="${dist.dir}/highcharts/js/adapters"><filterset refid="highcharts.filter"/></copy>
<copy file="${standalone.src.file}" todir="${dist.dir}/highstock/js/adapters"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/adapters/${standalone.minified.name}" todir="${dist.dir}/highstock/js/adapters"><filterset refid="highstock.filter"/></copy>
<copy file="${exporting.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${exporting.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${exporting.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${exporting.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${data.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${data.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${data.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${data.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${drilldown.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${drilldown.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${drilldown.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${drilldown.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${funnel.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${funnel.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${funnel.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${funnel.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${nodata.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${nodata.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${nodata.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${nodata.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${map.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${map.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${map.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${map.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${heatmap.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${heatmap.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${heatmap.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${heatmap.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${annotations.src.file}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${dist.dir}/js/modules/${annotations.minified.name}" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="${annotations.src.file}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="${dist.dir}/js/modules/${annotations.minified.name}" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="build/canvas-tools.src.js" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="build/canvas-tools.js" todir="${dist.dir}/highcharts/js/modules"><filterset refid="highcharts.filter"/></copy>
<copy file="build/canvas-tools.src.js" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="build/canvas-tools.js" todir="${dist.dir}/highstock/js/modules"><filterset refid="highstock.filter"/></copy>
<copy file="gfx/vml-radial-gradient.png" todir="${dist.dir}/highcharts/gfx"></copy>
<copy file="gfx/vml-radial-gradient.png" todir="${dist.dir}/highstock/gfx"></copy>
<copy todir="${dist.dir}/highcharts/js/themes">
<fileset dir="${themes.dir}"/>
</copy>
<copy todir="${dist.dir}/highstock/js/themes">
<fileset dir="${themes.dir}"/>
</copy>
<!-- 3. Create samples -->
<!-- Assemble the demo.html and demo.js files into example files for highcharts and highstock -->
<antcall target="create-samples">
<param name="demo.title" value="Highcharts"/>
<param name="samples.dir" value="samples/highcharts/demo"/>
<param name="samples.dist.dir" value="${dist.dir}/highcharts/"/>
</antcall>
<antcall target="create-samples">
<param name="demo.title" value="Highstock"/>
<param name="samples.dir" value="samples/stock/demo"/>
<param name="samples.dist.dir" value="${dist.dir}/highstock/"/>
</antcall>
<sleep seconds="1"/>
<!-- The demos are checked in with references to highcharts.com to be able to run them from jsfiddle -->
<!-- replace these references with local paths here -->
<replace dir="${dist.dir}">
<replacefilter>
<replacetoken><![CDATA[<script src="http://code.highcharts.com/stock/]]></replacetoken>
<replacevalue><![CDATA[<script src="../../js/]]></replacevalue>
</replacefilter>
<replacefilter>
<replacetoken><![CDATA[<script src="http://code.highcharts.com/]]></replacetoken>
<replacevalue><![CDATA[<script src="../../js/]]></replacevalue>
</replacefilter>
<include name="**/index.htm"/>
</replace>
<!-- Copy the analytics.tsv file to example -->
<copy file="samples/highcharts/demo/line-ajax/analytics.tsv" todir="${dist.dir}/highcharts/examples/line-ajax/"/>
<!-- Copy index files -->
<copy file="samples/highcharts/demo/index.htm" todir="${dist.dir}/highcharts/"/>
<copy file="samples/stock/demo/index.htm" todir="${dist.dir}/highstock/"/>
<!-- Copy graphic files -->
<copy todir="${dist.dir}/highcharts/graphics">
<fileset dir="samples/graphics"/>
</copy>
<copy todir="${dist.dir}/highstock/graphics">
<fileset dir="samples/graphics"/>
</copy>
<!-- 4. Copy export server -->
<!-- update highcharts export-server with newest js -->
<copy file="${dist.dir}/highcharts/js/highcharts.js" todir="exporting-server/phantomjs/"/>
<copy file="${dist.dir}/highstock/js/highstock.js" todir="exporting-server/phantomjs/"/>
<copy file="${dist.dir}/highcharts/js/highcharts-more.js" todir="exporting-server/phantomjs/"/>
<copy file="${dist.dir}/highcharts/js/modules/data.js" todir="exporting-server/phantomjs/"/>
<!-- copy files from phantomjs to java export server -->
<copy todir="exporting-server/java/highcharts-export/highcharts-export-convert/src/main/resources/phantomjs">
<fileset dir="exporting-server/phantomjs/">
<exclude name="*.md"/>
</fileset>
</copy>
<!-- copy highcharts export-server -->
<copy todir="${dist.dir}/highcharts/exporting-server">
<fileset dir="exporting-server"/>
</copy>
<delete file="${dist.dir}/highcharts/exporting-server/phantomjs/highstock.js" />
<delete file="${dist.dir}/highcharts/exporting-server/java/highcharts-export/highcharts-export-convert/src/main/resources/phantomjs/highstock.js" />
<replace file="${dist.dir}/highcharts/exporting-server/java/highcharts-export/highcharts-export-convert/src/main/resources/phantomjs/highcharts-convert.js" token="HIGHCHARTS: 'highstock.js'" value="HIGHCHARTS: 'highcharts.js'"/>
<!-- copy highstock export-server -->
<copy todir="${dist.dir}/highstock/exporting-server">
<fileset dir="exporting-server"/>
</copy>
<!-- Make sure files in the zip have lf line endings -->
<!-- even if being built on windows -->
<sleep seconds="5"/>
<fixcrlf srcdir="${dist.dir}" includes="**/*.js, **/*.html, **/*.htm, **/*.php, **/*.tsv" eol="lf" encoding="UTF-8" />
<!-- 5. Create zip files -->
<zip destfile="${dist.dir}/${highcharts.product.name}-${highcharts.product.version}.zip" basedir="${dist.dir}/highcharts"/>
<zip destfile="${dist.dir}/${highstock.product.name}-${highstock.product.version}.zip" basedir="${dist.dir}/highstock"/>
</target>
<!-- Starts the test driver server. -->
<target name="server" depends="set.properties" description="Starts the unit test server on localhost:4224.">
<!--
<exec executable="cmd" dir="${basedir}" osfamily="windows">
<arg value="/k start java -jar ${jstestdriver.jar} - -port 4224"/>
</exec>
-->
<java jar="${jstestdriver.jar}" fork="true">
<arg value="--port"/>
<arg value="4224"/>
</java>
<echo message="Test server started at localhost:4224"/>
<echo message="Before running tests, remember to capture one or more browsers."/>
<echo message="Exit the server by pressing Control-C in the java window."/>
</target>
<target name="test-all" description="Runs the unit tests on all adapters. The server must be running (i.e. 'server').">
<!-- Param "testrun.name" used in echo output and to build a folder name where test result goes. -->
<!-- Param "testrun.type" tells which type of test this is, also corresponds to the path name for the conf file. -->
<!-- Param "required.lib" specifies wich third-party lib is used while testing. -->
<!-- Param "required.adapter" specifies the corresponding adapter that matches the lib. Leave unset for the built-in jquery support. -->
<!-- jquery versions -->
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="jquery-1.8.0"/>
<param name="required.lib" value="jquery-1.8.0.js"/>
</antcall>
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="jquery-1.7.2"/>
<param name="required.lib" value="jquery-1.7.2.js"/>
</antcall>
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="jquery-1.6.4"/>
<param name="required.lib" value="jquery-1.6.4.js"/>
</antcall>
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="jquery-1.5.2"/>
<param name="required.lib" value="jquery-1.5.2.js"/>
</antcall>
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="jquery-1.4.4"/>
<param name="required.lib" value="jquery-1.4.4.js"/>
</antcall>
<!-- no library -->
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="standalone"/>
<param name="required.adapter" value="js/adapters/standalone-framework.src.js"/>
</antcall>
<!-- mootools versions -->
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="mootools-1.4.5"/>
<param name="required.lib" value="mootools-core-1.4.5-full-nocompat.js"/>
<param name="required.adapter" value="js/adapters/mootools-adapter.src.js"/>
</antcall>
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="mootools-1.3.2"/>
<param name="required.lib" value="mootools-core-1.3.2-full-compat.js"/>
<param name="required.adapter" value="js/adapters/mootools-adapter.src.js"/>
</antcall>
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="mootools-1.2.5"/>
<param name="required.lib" value="mootools-1.2.5-core-nc.js"/>
<param name="required.adapter" value="js/adapters/mootools-adapter.src.js"/>
</antcall>
<!-- prototype versions -->
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="prototype-1.7.0.0"/>
<param name="required.lib" value="prototype-1.7.0.0.js"/>
<param name="required.adapter" value="js/adapters/prototype-adapter.src.js"/>
</antcall>
</target>
<target name="test" description="Runs the unit tests using latest jquery. The server must be running (i.e. 'server').">
<antcall target="test-specific-lib">
<param name="testrun.type" value="unit"/>
<param name="testrun.name" value="jquery-1.8.0"/>
<param name="required.lib" value="jquery-1.8.0.js"/>
</antcall>
</target>
<target name="it" description="Runs the integration tests using latest jquery. The server must be running (i.e. 'server').">
<antcall target="test-specific-lib">
<param name="testrun.type" value="it"/>
<param name="testrun.name" value="jquery-1.8.0"/>
<param name="required.lib" value="jquery-1.8.0.js"/>
</antcall>
</target>
<target name="gc" description="Runs the leaks tests using latest jquery. The server must be running (i.e. 'server').">
<antcall target="test-specific-lib">
<param name="testrun.type" value="gc"/>
<param name="testrun.name" value="jquery-1.8.0"/>
<param name="required.lib" value="jquery-1.8.0.js"/>
</antcall>
</target>
<!-- Replace the lib with the specified ones, if set. -->
<target name="replace-lib" if="required.lib">
<replace file="jsTestDriver.conf" token="#required.lib" value=" - lib/${required.lib}"/>
</target>
<!-- Replace the adapter with the specified ones, if set. -->
<target name="replace-adapter" if="required.adapter">
<replace file="jsTestDriver.conf" token="#required.adapter" value=" - ${required.adapter}"/>
</target>
<target name="test-specific-lib" depends="set.properties">
<!-- Copy the templated jsTestDriver configuration to root. -->
<copy file="test/${testrun.type}/jsTestDriver.conf" todir="${basedir}" overwrite="true"/>
<!-- Expand the tokens to valid js files. -->
<antcall target="replace-lib"/>
<antcall target="replace-adapter"/>
<!-- Create the folder where the report is stored. -->
<mkdir dir="${testoutput.dir}/${testrun.name}"/>
<!-- Run the tests -->
<antcall target="run-test"/>
</target>
<!-- Runs the tests without coverage. This is much faster than with coverage enabled. -->
<target name="run-test" depends="set.properties">
<echo message="/------------------------------------------------------------"/>
<echo message=" Running ${testrun.type} tests using: ${testrun.name}"/>
<echo message=""/>
<echo message=""/>
<java jar="${jstestdriver.jar}" fork="true">
<arg value="--config"/>
<arg value="jsTestDriver.conf"/>
<arg value="--testOutput"/>
<arg value="${testoutput.dir}/${testrun.name}"/>
<arg value="--tests"/>
<arg value="all"/>
<arg value="--reset"/>
</java>
<echo message=""/>
<echo message=""/>
<echo message="\------------------------------------------------------------"/>
</target>
<!-- Starts the test driver server with coverage enabled. -->
<!-- This must be done on a separate port to the test-server. -->
<target name="server-coverage" depends="set.properties" description="Starts the unit test server with coverage enabled on localhost:5225.">
<!-- Copy the jsTestDriverCoverage configuration to root. -->
<copy file="test/unit/jsTestDriverCoverage.conf" todir="${basedir}" overwrite="true"/>
<exec executable="cmd" dir="${basedir}" >
<arg value="/k start java -jar ${jstestdriver.jar} --config jsTestDriverCoverage.conf --port 5225"/>
</exec>
<echo message="Coverage test server started at localhost:5225"/>
<echo message="Before running tests, remember to capture one or more browsers."/>
<echo message="Exit the server by pressing Control-C in the java window."/>
</target>
<!-- Runs coverage analysis for the tests. -->
<target name="test-coverage" depends="set.properties" description="Runs the unit tests together with code coverage. The server must be running (i.e. 'server-coverage')">
<!-- Copy the jsTestDriverCoverage configuration to root. -->
<copy file="test/unit/jsTestDriverCoverage.conf" todir="${basedir}" overwrite="true"/>
<!-- Run the tests with coverage enabled. -->
<java jar="${jstestdriver.jar}" fork="true">
<arg value="--config"/>
<arg value="jsTestDriverCoverage.conf"/>
<arg value="--testOutput"/>
<arg value="${testoutput.dir}"/>
<arg value="--tests"/>
<arg value="all"/>
<arg value="--verbose"/>
</java>
</target>
<!-- Generates a code-coverage report based on the output from the 'test-coverage' task. -->
<target name="test-report" depends="set.properties" description="Generates a code-coverage report based on the output from the 'test-coverage' task.">
<!-- When running on windows, the output from coverage is windows-style, but the report requires unix-style paths. -->
<!-- Replace dos-drive 'C:' with unix style '/C'. -->
<replace file="${testoutput.dir}/jsTestDriver.conf-coverage.dat" token="SF:C:" value="SF:/C" summary="true"/>
<!-- Replace dos-paths '\' with unix style '/'. -->
<replace file="${testoutput.dir}/jsTestDriver.conf-coverage.dat" token="\" value="/" summary="true"/>
<!-- Run perl and the genhtml script to create the report. -->
<exec executable="perl" dir="${basedir}">
<arg value="-w"/>
<arg value="tools/lcov-1.9/bin/genhtml"/>
<arg line="-o ${coveragereport.dir} --no-branch-coverage --no-function-coverage --legend --title 'Highcharts test coverage' build/tests/jsTestDriver.conf-coverage.dat"/>
</exec>
<!-- Point the browser to the report. -->
<property name="browser" location="C:/Program Files (x86)/Mozilla Firefox/firefox.exe"/>
<property name="file" location="${coveragereport.dir}/index.html"/>
<exec executable="${browser}" spawn="true">
<arg value="${file}"/>
</exec>
</target>
<!-- gzip javascript files in folder -->
<target name="gzip-js" description="gzip all javascript versions for upload to Amazon S3" depends="set.properties">
<property name="gzip.dir" value="${js.dir}/../js-gzip"/>
<delete dir="${gzip.dir}"/>
<mkdir dir="${gzip.dir}"/>
<echo message="placing zipped folder structure in ${gzip.dir}"/>
<!-- make copy so we don't double-compress files -->
<sync todir="${gzip.dir}" includeEmptyDirs="true" overwrite="true">
<fileset dir="${js.dir}" includes="**/*.js"/>
</sync>
<ac:for param="file">
<path>
<fileset dir="${gzip.dir}"/>
</path>
<sequential>
<!-- we keep the filenames the same and transparently serve gzipped content via http headers -->
<gzip src="@{file}" destfile="@{file}.gz"/>
<move file="@{file}.gz" tofile="@{file}" overwrite="true"/>
</sequential>
</ac:for>
</target>
<target name="put-gzipped-files-to-S3">
<!-- HINT: to upload just the contents, specify the directory with a trailing slash, if you want to upload the whole directory specify the directory without trailing slash -->
<!-- HINT: The sync command will compare checksums and sizes of the remote vs local files and only want to upload those that are new. When using skip-existing only file presence is checked, NOT the content -->
<echo message="synch local folder: ${local} with remote S3 path: ${remote}"/>
<!-- Upload the .js files to remote S3 version folder -->
<!--exec executable="s3cmd" failonerror="true"-->
<exec dir="${s3cmdDir}" executable="python" failonerror="true">
<arg line="s3cmd"/>
<arg value="--guess-mime-type"/>
<arg value="--add-header=Vary:Accept-Encoding"/>
<!-- tell proxies to only serve this compressed content to a client who has the accept-encoding header: http://blog.port80software.com/2005/01/21/; NOT REALLY NECESSARY in our case were only serving gzipped js. But it will maybe help for proxy-servers in transition to only gzipped files -->
<arg value="--add-header=Content-Encoding:gzip"/>
<arg value="--add-header=Cache-Control:public, max-age=${max.age}"/>
<arg value="--add-header=Expires:${http.expires}"/>
<arg value="--encoding=UTF-8"/>
<arg value="--recursive"/>
<arg value="--acl-public"/>
<arg value="--verbose"/>
<arg value="--no-preserve"/>
<!--arg value="-!-dry-run" /-->