/
build.xml
647 lines (590 loc) · 28.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
<?xml version="1.0" encoding="utf-8" ?>
<project name="Charba" default="buildBinaryGwt" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!--
Apache Ivy task definition and load properties
-->
<loadproperties srcfile="ivymoduleconfiguration.properties" />
<!--
CHARBA configuration and paths
-->
<property name="charba.description" value="Charba - J2CL and GWT charts library based on CHART.JS"/>
<property name="charba.built.by" value="www.pepstock.org" />
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<property name="src.dir" value="src" />
<property name="codegen.dir" value="codegen" />
<property name="classes.dir" value="classes" />
<property name="lib.dir" value="lib-ivy" />
<property name="javadoc.dir" value="javadoc" />
<property name="resources.dir" value="resources" />
<property name="retrieve.dir" value="retrieve" />
<property name="dist.dir" value="dist" />
<property name="temp.dir" value="temp"/>
<property name="log.dir" value="log"/>
<property name="manifest.file" value="${temp.dir}/MANIFEST.MF"/>
<property name="all.sources.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}-sources.zip" />
<!--
CHARBA target properties for J2CL distribution
-->
<property name="bin.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}.jar" />
<property name="sources.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}-sources.jar" />
<property name="javadoc.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}-javadoc.jar" />
<property name="artifact.pattern" value="${dist.dir}/[artifact]-[revision](-[classifier]).[ext]" />
<!--
CHARBA target properties for GWT distribution
-->
<property name="bin.gwt.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}-gwt.jar" />
<property name="sources.gwt.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}-gwt-sources.jar" />
<property name="javadoc.gwt.archive.file" value="${dist.dir}/charba-${ivy.pubrevision}-gwt-javadoc.jar" />
<!--
CHARBA target properties for java script files
-->
<property name="javascript.charba.file" value="charba.helper.js" />
<property name="javascript.charba.minify.file" value="charba.helper.min.js" />
<property name="javascript.package" value="org/pepstock/charba/client/resources/js" />
<property name="javascript.src.dir" value="${src.dir}/${javascript.package}" />
<property name="javascript.dist.dir" value="${classes.dir}/${javascript.package}" />
<!--
LABELS CHART.JS plugin - waiting for approval of pull request
https://github.com/emn178/chartjs-plugin-labels/pull/88
-->
<property name="javascript.labels.file" value="chartjs-plugin-labels.js" />
<property name="javascript.labels.minify.file" value="chartjs-plugin-labels.min.js" />
<!--
CHART.JS
-->
<!--property name="javascript.chartjs.minify.file" value="chart.bundle.min.js" /-->
<property name="javascript.chartjs.minify.file" value="chart.min.js" />
<!--
EXTENSIONS CHART.JS plugins
-->
<property name="javascript.datalabels.minify.file" value="chartjs-plugin-datalabels.min.js" />
<property name="javascript.zoom.minify.file" value="chartjs-plugin-zoom.min.js" />
<property name="javascript.hammer.minify.file" value="hammer.min.js" />
<!--
CHART.JS date adapters
-->
<property name="javascript.chartjs.datefns.minify.file" value="chartjs-adapter-date-fns.bundle.min.js" />
<property name="javascript.chartjs.luxon.minify.file" value="chartjs-adapter-luxon.min.js" />
<property name="javascript.chartjs.moment.minify.file" value="chartjs-adapter-moment.min.js" />
<property name="javascript.moment.minify.file" value="moment.min.js" />
<property name="javascript.luxon.minify.file" value="luxon.min.js" />
<!--
JAVA compiler options
-->
<property name="javac.debug" value="true" />
<property name="javac.debuglevel" value="lines,vars,source" />
<property name="javac.source" value="1.8" />
<property name="javac.target" value="1.8" />
<property name="javac.includeantruntime" value="false" />
<property name="javac.nowarn" value="true" />
<!--
IVY targets for getting build dependencies and Travis CI needed libraries
-->
<property name="ivy.file" value="ivy.xml"/>
<property name="ant.jar.dir" value="${user.home}/.ant/lib" />
<!--
**** IVY TARGET SECTIONS ****
-->
<!--
IVY - Download IVY
-->
<target name="ivyDownload">
<!-- Download the Ivy jar and then invoke it to download the others task libs -->
<mkdir dir="${ant.jar.dir}"/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${depver.ivy}/ivy-${depver.ivy}.jar"
dest="${ant.jar.dir}" usetimestamp="true"/>
<antcall target="ivyTaskdef" />
</target>
<!--
IVY - ANT task definitions for IVY
-->
<target name="ivyTaskdef">
<mkdir dir="${ant.jar.dir}"/>
<!-- Define the ivyPath with all jars located in ${ant.jar.dir} -->
<path id="ivyPath">
<fileset dir="${ant.jar.dir}">
<include name="**/ivy-${depver.ivy}.jar"/>
</fileset>
</path>
<!-- Define the Ivy tasks -->
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivyPath" />
</target>
<!--
IVY - Setup IVY
-->
<target name="ivySetup" depends="ivyDownload, ivyTaskdef" />
<!--
IVY - Retrieves by IVY the needed jar
-->
<macrodef name="ivyRetrieve">
<attribute name="ivyFile"/>
<attribute name="conf"/>
<attribute name="pattern"/>
<attribute name="pathId"/>
<sequential>
<ivy:retrieve file="@{ivyFile}" conf="@{conf}" pattern="@{pattern}" pathid="@{pathId}" sync="true"/>
<ivy:report todir="${log.dir}" graph="false"/>
</sequential>
</macrodef>
<target name="ivyRetrieveCompile" depends="ivyTaskdef">
<ivyRetrieve ivyfile="${ivy.file}" conf="compile" pathid="ivyPath-compile" pattern="${lib.dir}/compile/[artifact]-[revision](-[classifier]).[ext]"/>
</target>
<target name="ivyRetrieveRuntime" depends="ivyTaskdef">
<ivyRetrieve ivyfile="${ivy.file}" conf="runtime" pathid="ivyPath-runtime" pattern="${lib.dir}/runtime/[artifact]-[revision](-[classifier]).[ext]"/>
</target>
<target name="ivyRetrieve" depends="ivyRetrieveCompile, ivyRetrieveRuntime" />
<!--
IVY - Makes POM file
-->
<macrodef name="makePom">
<attribute name="pomFile"/>
<attribute name="name"/>
<attribute name="description"/>
<attribute name="version"/>
<attribute name="url"/>
<sequential>
<property name="ivy.pom.name" value="@{name}"/>
<property name="ivy.pom.description" value="@{description}"/>
<property name="ivy.pom.version" value="@{version}"/>
<property name="ivy.pom.url" value="@{url}"/>
<property name="ivy.pom.packaging" value="jar"/>
<ivy:makepom ivyfile="ivy.xml" pomfile="@{pomFile}" templatefile="pom.template" conf="runtime">
<mapping conf="runtime" scope="runtime" />
</ivy:makepom>
</sequential>
</macrodef>
<target name="ivyMakePom" depends="ivyTaskdef">
<makePom pomfile="${dist.dir}/charba-${ivy.pubrevision}.pom"
name="Charba" description="${charba.description}"
version="${ivy.pubrevision}" url="www.pepstock.org"/>
</target>
<target name="ivyMakePomGwt" depends="ivyTaskdef">
<makePom pomfile="${dist.dir}/charba-${ivy.pubrevision}-gwt.pom"
name="Charba GWT" description="${charba.description}"
version="${ivy.pubrevision}-gwt" url="www.pepstock.org"/>
</target>
<!--
IVY - Publishes official release into MVN
-->
<macrodef name="ivyPublish">
<attribute name="resolver"/>
<attribute name="version"/>
<sequential>
<ivy:resolve file="${ivy.file}" revision="@{version}"/>
<ivy:publish resolver="@{resolver}" pubrevision="@{version}" forcedeliver="true" overwrite="true"
publishivy="false" artifactspattern="${artifact.pattern}" />
</sequential>
</macrodef>
<target name="ivyPublishRelease" depends="ivyTaskdef">
<ivyPublish resolver="nexus-releases" version="${ivy.pubrevision}" />
</target>
<target name="ivyPublishReleaseGwt" depends="ivyTaskdef">
<ivyPublish resolver="nexus-releases" version="${ivy.pubrevision}-gwt" />
</target>
<!--
IVY - Publishes snapshots into MVN
-->
<target name="ivyPublishSnapshot" depends="ivyTaskdef">
<ivyPublish resolver="nexus-snapshots" version="${ivy.pubrevision}-SNAPSHOT" />
</target>
<target name="ivyPublishSnapshotGwt" depends="ivyTaskdef">
<ivyPublish resolver="nexus-snapshots" version="${ivy.pubrevision}-gwt-SNAPSHOT" />
</target>
<!--
**** COMMON SECTIONS ****
-->
<!--
CHARBA - Removes the unused forders and contents from all used folders
-->
<target name="clean" description="Cleans folders">
<delete failonerror="false" includeemptydirs="true">
<!-- includes="**/*" attribute deletes only content leaving directory empty -->
<fileset dir="${classes.dir}" includes="**/*"/>
<fileset dir="${dist.dir}" includes="**/*"/>
<fileset dir="${javadoc.dir}" includes="**/*"/>
<fileset dir="${temp.dir}" includes="**/*" />
<fileset dir="${log.dir}" includes="**/*" />
</delete>
</target>
<!--
CHARBA - Closure compiler definition
-->
<target name="init" depends="ivySetup, ivyRetrieveCompile">
<!-- Define Google Closure task -->
<taskdef name="closure-compiler" classname="com.google.javascript.jscomp.ant.CompileTask" classpathref="ivyPath-compile" />
</target>
<!--
CHARBA - JAVA compile, MINIFY CHARBA javascript helper, COPY resources into classes folder
-->
<target name="compile" depends="clean, init, ivyRetrieveRuntime">
<mkdir dir="${classes.dir}"/>
<javac includes="**" encoding="utf-8" destdir="${classes.dir}" includeantruntime="${javac.includeantruntime}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" createMissingPackageInfoClass="false">
<src path="${src.dir}"/>
<src path="${codegen.dir}"/>
<classpath>
<path refid="ivyPath-runtime" />
<path refid="ivyPath-compile"/>
</classpath>
</javac>
<!-- minify CHARBA Helper-->
<echo>Minify CHARBA helper from file "${javascript.charba.file}" to "${javascript.charba.minify.file}" </echo>
<closure-compiler compilationLevel="simple" debug="true" output="${javascript.dist.dir}/${javascript.charba.minify.file}" forceRecompile="true">
<sources dir="${javascript.src.dir}">
<file name="${javascript.charba.file}" />
</sources>
</closure-compiler>
<!-- minify LABELS CHART.JS plugin -->
<echo>Minify LABELS plugin from file "${javascript.labels.file}" to "${javascript.labels.minify.file}" </echo>
<closure-compiler compilationLevel="simple" debug="true" output="${javascript.dist.dir}/${javascript.labels.minify.file}" forceRecompile="true">
<sources dir="${javascript.src.dir}">
<file name="${javascript.labels.file}" />
</sources>
</closure-compiler>
<!-- copy all sources is necessary as J2CL-GWT needs sources: exclude charba.helper.js and labels plugin because already created by minify and package-info-->
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<exclude name="**/package-info.java"/>
<exclude name="**/${javascript.charba.file}"/>
<exclude name="**/${javascript.labels.file}"/>
</fileset>
<fileset dir="${codegen.dir}"/>
</copy>
<!-- javascript resources (all libraries embeddable into CHARBA) to classes folder -->
<copy todir="${javascript.dist.dir}">
<fileset dir="${resources.dir}">
<include name="**/*.js"/>
</fileset>
</copy>
</target>
<!--
CHARBA - JAVADOC execution for J2CL
-->
<target name="javadoc" depends="ivyRetrieve">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${javadoc.dir}" includes="**/*"/>
</delete>
<!-- exclude from java doc all classes where GWT is used and all files not JAVA -->
<javadoc destdir="${javadoc.dir}" useexternalfile="yes" author="true" version="true" use="true" encoding="utf-8"
windowtitle="${charba.description}">
<fileset dir="${src.dir}">
<include name="org/pepstock/**" />
<exclude name="**/*.js" />
<exclude name="**/*.xml" />
<exclude name="org/pepstock/charba/client/gwt/**"/>
<exclude name="org/pepstock/charba/client/resources/AbstractDeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/DatefnsDeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/DeferredDateAdapterResources.java"/>
<exclude name="org/pepstock/charba/client/resources/DeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/EntryPointStarter.java"/>
<exclude name="org/pepstock/charba/client/resources/InternalInjectableTextResource.java"/>
<exclude name="org/pepstock/charba/client/resources/InjectableTextResource.java"/>
<exclude name="org/pepstock/charba/client/resources/LuxonDeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/ResourceLoadException.java"/>
</fileset>
<classpath>
<path refid="ivyPath-compile" />
<fileset dir="${classes.dir}" />
<pathelement path="${java.class.path}" />
</classpath>
<link offline="false" href="https://docs.oracle.com/javase/8/docs/api/" />
<link offline="false" href="http://www.gwtproject.org/javadoc/latest/" />
<link offline="false" href="https://javadoc.io/doc/com.google.jsinterop/base/latest" />
</javadoc>
</target>
<!--
CHARBA - JAVADOC execution for GWT
-->
<target name="javadocGwt" depends="ivyRetrieve">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${javadoc.dir}" includes="**/*"/>
</delete>
<javadoc destdir="${javadoc.dir}" useexternalfile="yes" author="true" version="true" use="true" encoding="utf-8"
windowtitle="${charba.description}">
<classpath>
<path refid="ivyPath-compile" />
<fileset dir="${classes.dir}" />
<pathelement path="${java.class.path}" />
</classpath>
<packageset dir="${src.dir}" defaultexcludes="yes">
<include name="org/pepstock/**" />
</packageset>
<link offline="false" href="https://docs.oracle.com/javase/8/docs/api/" />
<link offline="false" href="http://www.gwtproject.org/javadoc/latest/" />
<link offline="false" href="https://javadoc.io/doc/com.google.jsinterop/base/latest" />
</javadoc>
</target>
<!--
CHARBA - CREATE sources jar file for J2CL
-->
<target name="createSources" depends="makeManifest">
<!-- exclude from jar all classes where GWT is used, all javascript sources (not needed because embedded into java classes) and code gen source folder -->
<jar jarfile="${sources.archive.file}" manifest="${manifest.file}" encoding="UTF-8">
<fileset dir="${classes.dir}">
<include name="**/*"/>
<exclude name="**/*.class"/>
<exclude name="org/pepstock/charba/client/gwt/**"/>
<exclude name="org/pepstock/charba/client/resources/AbstractDeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/DatefnsDeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/DeferredDateAdapterResources.java"/>
<exclude name="org/pepstock/charba/client/resources/DeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/EntryPointStarter.java"/>
<exclude name="org/pepstock/charba/client/resources/InternalInjectableTextResource.java"/>
<exclude name="org/pepstock/charba/client/resources/InjectableTextResource.java"/>
<exclude name="org/pepstock/charba/client/resources/LuxonDeferredResources.java"/>
<exclude name="org/pepstock/charba/client/resources/ResourceLoadException.java"/>
<exclude name="org/pepstock/charba/client/resources/js/**"/>
<exclude name="org/pepstock/charba/codegen/**"/>
</fileset>
</jar>
</target>
<!--
CHARBA - CREATE manifest file shared among all archives in a temporary directory
-->
<target name="makeManifest">
<mkdir dir="${temp.dir}"/>
<manifest file="${manifest.file}">
<section name="Charba">
<attribute name="Version" value="${ivy.pubrevision}" />
<attribute name="Built-By" value="${charba.built.by}" />
<attribute name="Creation-time" value="${TODAY}" />
</section>
</manifest>
</target>
<!--
CHARBA - CREATE sources jar file for GWT
-->
<target name="createSourcesGwt" depends="makeManifest">
<!-- exclude from jar the GWT module defined for Charba J2CL and code gen source folder -->
<jar jarfile="${sources.gwt.archive.file}" manifest="${manifest.file}" encoding="UTF-8">
<fileset dir="${classes.dir}">
<include name="**/*"/>
<exclude name="**/*.class"/>
<exclude name="org/pepstock/charba/codegen/**"/>
<exclude name="org/pepstock/charba/client/resources/externs/**"/>
<exclude name="org/pepstock/charba/client/gwt/Charba.gwt.xml"/>
</fileset>
</jar>
</target>
<!--
CHARBA - CREATE javadoc jar file for J2CL
-->
<macrodef name="createJavadoc">
<attribute name="file" />
<sequential>
<jar jarfile="@{file}" encoding="UTF-8">
<fileset dir="${javadoc.dir}" />
<manifest>
<section name="Charba">
<attribute name="Version" value="${ivy.pubrevision}" />
<attribute name="Built-By" value="${charba.built.by}" />
<attribute name="Creation-time" value="${TODAY}" />
</section>
</manifest>
</jar>
</sequential>
</macrodef>
<target name="createJavadoc" depends="javadoc">
<createJavadoc file="${javadoc.archive.file}"/>
</target>
<!--
CHARBA - CREATE javadoc jar file for GWT
-->
<target name="createJavadocGwt" depends="javadocGwt">
<createJavadoc file="${javadoc.gwt.archive.file}"/>
</target>
<!--
CHARBA - CREATE classes jar file for J2CL
-->
<target name="createBinary" depends="compile, makeManifest">
<!-- exclude from jar all classes where GWT is used, all javascript sources (not needed because embedded into java classes) and code gen source folder -->
<jar jarfile="${bin.archive.file}" manifest="${manifest.file}" encoding="UTF-8">
<fileset dir="${classes.dir}">
<include name="**/*"/>
<exclude name="org/pepstock/charba/codegen/**"/>
<exclude name="org/pepstock/charba/client/gwt/**"/>
<exclude name="org/pepstock/charba/client/resources/AbstractDeferredResources*"/>
<exclude name="org/pepstock/charba/client/resources/DatefnsDeferredResources*"/>
<exclude name="org/pepstock/charba/client/resources/DeferredDateAdapterResources*"/>
<exclude name="org/pepstock/charba/client/resources/DeferredResources*"/>
<exclude name="org/pepstock/charba/client/resources/EntryPointStarter*"/>
<exclude name="org/pepstock/charba/client/resources/InternalInjectableTextResource*"/>
<exclude name="org/pepstock/charba/client/resources/InjectableTextResource*"/>
<exclude name="org/pepstock/charba/client/resources/LuxonDeferredResources*"/>
<exclude name="org/pepstock/charba/client/resources/ResourceLoadException*"/>
<exclude name="org/pepstock/charba/client/resources/js/**"/>
</fileset>
</jar>
</target>
<!--
CHARBA - CREATE classes jar file for GWT
-->
<target name="createBinaryGwt" depends="compile, makeManifest">
<!-- override the GWT module defined for Charba J2CL with GWT one -->
<copy file="${classes.dir}/org/pepstock/charba/client/gwt/Charba.gwt.xml" todir="${classes.dir}/org/pepstock/charba"/>
<!-- exclude from jar the GWT module defined for Charba GWT (because copied on right folder above) and code gen source folder -->
<jar jarfile="${bin.gwt.archive.file}" manifest="${manifest.file}" encoding="UTF-8">
<fileset dir="${classes.dir}">
<include name="**/*"/>
<exclude name="org/pepstock/charba/codegen/**"/>
<exclude name="org/pepstock/charba/client/resources/externs/**"/>
<exclude name="org/pepstock/charba/client/gwt/Charba.gwt.xml"/>
</fileset>
</jar>
</target>
<!--
CHARBA - CREATE all sources ZIP file
-->
<target name="createAllSources">
<!-- exclude from zip all classes and code gen source folder -->
<zip destfile="${all.sources.archive.file}">
<fileset dir="${classes.dir}">
<include name="**/*"/>
<exclude name="**/*.class"/>
<exclude name="org/pepstock/charba/codegen/**"/>
</fileset>
</zip>
</target>
<!--
CHARBA - BUILD all binaries
-->
<target name="buildBinary" depends="createBinary" />
<!--
CHARBA - BUILD all binaries
-->
<target name="buildBinaryGwt" depends="createBinaryGwt" />
<!--
CHARBA - BUILD all jars artifacts: classes, sources and javadoc
PAY attentio that the sequence of target dependencies MUST NOT be changed
-->
<target name="buildAll" depends="buildBinary, createSources, createJavadoc, createAllSources, buildBinaryGwt, createSourcesGwt, createJavadocGwt" />
<!--
CHARBA - Code generator to wrap the java script files into java classes
-->
<target name="codeGenerator" depends="init, ivyRetrieveRuntime">
<javac srcdir="${codegen.dir}" includes="**" encoding="utf-8" destdir="${classes.dir}" includeantruntime="${javac.includeantruntime}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" createMissingPackageInfoClass="false">
<classpath>
<path refid="ivyPath-runtime" />
<path refid="ivyPath-compile"/>
</classpath>
</javac>
<!-- minify CHARBA Helper-->
<echo>Minify CHARBA helper from file "${javascript.charba.file}" to "${javascript.charba.minify.file}" </echo>
<closure-compiler compilationLevel="simple" debug="true" output="${javascript.dist.dir}/${javascript.charba.minify.file}" forceRecompile="true">
<sources dir="${javascript.src.dir}">
<file name="${javascript.charba.file}" />
</sources>
</closure-compiler>
<!-- minify LABELS CHART.JS plugin -->
<echo>Minify LABELS plugin from file "${javascript.labels.file}" to "${javascript.labels.minify.file}" </echo>
<closure-compiler compilationLevel="simple" debug="true" output="${javascript.dist.dir}/${javascript.labels.minify.file}" forceRecompile="true">
<sources dir="${javascript.src.dir}">
<file name="${javascript.labels.file}" />
</sources>
</closure-compiler>
<!-- copy all sources is necessary as J2CL-GWT needs sources: exclude charba.helper.js and labels plugin because already created by minify and package-info-->
<copy todir="${javascript.dist.dir}">
<fileset dir="${resources.dir}">
<include name="**/*.js"/>
</fileset>
</copy>
<!-- invokes code generator -->
<echo>Creating CHARBA injectable resources...</echo>
<java classname="org.pepstock.charba.codegen.InjectableResourceGenerator">
<classpath>
<pathelement location="${classes.dir}"/>
</classpath>
</java>
<echo>Created CHARBA injectable resources</echo>
</target>
<!--
**** RETRIEVE javascript libraries ****
-->
<!--
CHARBA - gets the javascript minify of CHART.JS and datalabels plugin
PAY ATTENTION: these targets are insterted only for documentation and to get javascripts but before to apply must be checked
-->
<target name="retrieveOfficialChartJS">
<echo>Retrieve CHART.JS minify javascript resource - version ${depver.chartjs}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.chartjs.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chart.js@${depver.chartjs}/dist/Chart.min.js" dest="${retrieve.dir}/${javascript.chartjs.minify.file}" />
</target>
<target name="retrieveLatestChartJS">
<echo>Retrieve CHART.JS minify javascript resource - latest build [MUST not be used for production purposes]</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.chartjs.minify.file}" />
</delete>
<get src="https://www.chartjs.org/dist/master/Chart.bundle.min.js" dest="${retrieve.dir}/${javascript.chartjs.minify.file}" />
</target>
<target name="retrieveOfficialDatalabels">
<echo>Retrieve DATALABELS plugin minify javascript resource - version ${depver.datalabels}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.datalabels.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@${depver.datalabels}" dest="${retrieve.dir}/${javascript.datalabels.minify.file}" />
</target>
<target name="retrieveLatestDatalabels">
<echo>Retrieve DATALABELS plugin minify javascript resource - latest build [MUST not be used for production purposes]</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.datalabels.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels" dest="${retrieve.dir}/${javascript.datalabels.minify.file}" />
</target>
<target name="retrieveOfficialZoom">
<echo>Retrieve ZOOM plugin minify javascript resource - version ${depver.zoom}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.zoom.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom@${depver.zoom}" dest="${retrieve.dir}/${javascript.zoom.minify.file}" />
<echo>Retrieve HAMMER minify javascript resource - version ${depver.hammer}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.hammer.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/hammerjs@${depver.hammer}" dest="${retrieve.dir}/${javascript.hammer.minify.file}" />
</target>
<target name="retrieveOfficialMoment">
<echo>Retrieve MOMENT CHART.JS date adapter minify javascript resource - version ${depver.chartjs.moment}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.chartjs.moment.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@${depver.chartjs.moment}" dest="${retrieve.dir}/${javascript.chartjs.moment.minify.file}" />
<echo>Retrieve MOMENT minify javascript resource - version ${depver.moment}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.moment.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/moment@${depver.moment}" dest="${retrieve.dir}/${javascript.moment.minify.file}" />
</target>
<target name="retrieveOfficialLuxon">
<echo>Retrieve LUXON CHART.JS date adapter minify javascript resource - version ${depver.chartjs.luxon}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.chartjs.luxon.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@${depver.chartjs.luxon}" dest="${retrieve.dir}/${javascript.chartjs.luxon.minify.file}" />
<echo>Retrieve LUXON minify javascript resource - version ${depver.luxon}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.luxon.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/luxon@${depver.luxon}" dest="${retrieve.dir}/${javascript.luxon.minify.file}" />
</target>
<target name="retrieveOfficialDateFns">
<echo>Retrieve DATE-FNS CHART.JS date adapter minify javascript resource - version ${depver.chartjs.datefns}</echo>
<mkdir dir="${retrieve.dir}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${retrieve.dir}" includes="${javascript.chartjs.datefns.minify.file}" />
</delete>
<get src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@${depver.chartjs.datefns}/dist/chartjs-adapter-date-fns.bundle.min.js" dest="${retrieve.dir}/${javascript.chartjs.datefns.minify.file}" />
</target>
</project>