forked from dotCMS/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
963 lines (787 loc) · 38.7 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
<?xml version="1.0"?>
<project name="dotcms.org" default="compile" basedir=".">
<!-- property name="build.compiler" value="jikes" / -->
<!-- Load version props -->
<property file="src/com/liferay/portal/util/build.properties"/>
<property file="test/build.properties" />
<!-- vars -->
<property name="src.dir" value="src" />
<property name="src.conf.dir" value="src-conf" />
<property name="src.tests.dir" value="test" />
<property name="src.jsp" value="build/jsp" />
<property name="sql.dotcms.dir" value="sql/cms" />
<property name="sql.liferay.dir" value="sql/portal" />
<property name="sql.quartz.dir" value="sql/quartz" />
<property name="sql.dotcms.oracle" value="dotcms_oracle.sql" />
<property name="sql.liferay.oracle" value="portal-oracle.sql" />
<property name="sql.quartz.oracle" value="tables_oracle.sql" />
<property name="sql.dotcms.postgres" value="dotcms_postgresql.sql" />
<property name="sql.dotcms.extra.postgres" value="dotcms_extra_postgres.sql" />
<property name="sql.dotcms.extra.oracle" value="dotcms_extra_oracle.sql" />
<property name="sql.dotcms.extra.mssql" value="dotcms_extra_mssql.sql" />
<property name="sql.dotcms.extra.mysql" value="dotcms_extra_mysql.sql" />
<property name="sql.liferay.postgres" value="portal-postgresql.sql" />
<property name="sql.quartz.postgres" value="tables_postgres.sql" />
<property name="sql.dotcms.mssql" value="dotcms_mssql-sybase.sql" />
<property name="sql.liferay.mssql" value="portal-sql-server.sql" />
<property name="sql.quartz.mssql" value="tables_mssql.sql" />
<property name="sql.dotcms.mysql" value="dotcms_mysql.sql" />
<property name="sql.liferay.mysql" value="portal-mysql.sql" />
<property name="sql.quartz.mysql" value="tables_mysql.sql" />
<property name="build.dir" value="build" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.ant" value="${build.dir}/ant" />
<property name="build.log4j" value="${build.dir}/log4j" />
<property name="build.lib" value="${build.dir}/lib" />
<property name="lib.app" value="${basedir}/dotCMS/WEB-INF/lib" />
<property name="classes.app" value="${basedir}/dotCMS/WEB-INF/classes" />
<property name="build.war" value="${build.dir}/war" />
<property name="build.compiler.fulldepend" value="true" />
<property name="deploy.dir" value="${basedir}/dotCMS/WEB-INF/lib" />
<property name="distribution.output" value="../dist" />
<property name="ant.build.javac.target" value="1.6"/>
<property name="war.name" value="dotcms"/>
<property name="endorsed_libs" value="${basedir}/dotCMS/WEB-INF/endorsed_libs" />
<property name="build.autoupdater" value="${basedir}/bin/autoupdater/build" />
<property name="dist.autoupdater" value="${basedir}/bin/autoupdater" />
<property name="agent.version" value="29"/>
<property name="plugin.root.dir.default" value="${basedir}/dotCMS"/>
<property name="plugin.jar.deploy.dir.default" value="${basedir}/../../dotCMS/WEB-INF/lib" />
<property name="distribution.dotserver.output" value="${distribution.output}/dotserver" />
<property name="distribution.autoupdater.output" value="${distribution.output}/autoupdater" />
<path id="build-classpath">
<pathelement path="${build.classes}" />
</path>
<path id="files-classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="tomcat/bin">
<include name="**/*.jar" />
</fileset>
<fileset dir="tomcat/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.app}">
<include name="**/*.jar" />
<exclude name="**/dotcms*.jar" />
</fileset>
<pathelement path="${build.classes}" />
</path>
<!-- classpath only used for plugins no other task should use becuase it locks the jar files -->
<path id="ant-files-classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="tomcat/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.app}">
<include name="log4j.jar" />
<include name="dotcms_ant.jar" />
<include name="commons-lang-2.4.jar" />
</fileset>
</path>
<!-- Target to create the build directories prior to the -->
<!-- compile target. -->
<target name="prepare">
<mkdir dir="${distribution.output}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.lib}" />
</target>
<target name="clean-tinymce-gz" description="Removes all generated .gz pre-compressed files by tinymce_gzip.jsp">
<delete>
<fileset dir="dotCMS/html/js/tinymce/jscripts/tiny_mce/" includes="*.gz"/>
</delete>
</target>
<target name="clean-core" description="Removes all compiled classes, jar." depends="check-src-build">
<replaceregexp flags="s" match="<!-- BEGIN JSPS -->(.*)<!-- END JSPS -->"
replace="<!-- BEGIN JSPS --> <!-- END JSPS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<delete dir="${build.dir}" />
<delete dir="${src.jsp}" />
<delete dir="${distribution.output}" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${classes.app}" includes="**/*" />
</delete>
</target>
<target name="clean-jsp" description="Removes all generated files.">
<delete dir="work/Catalina" />
</target>
<target name="compile" depends="check-src-build,prepare" description="Compiles all source code.">
<javac debug="true" encoding="UTF-8" debuglevel="lines,vars,source" fork="true" srcdir="${src.dir}" destdir="${build.classes}" source="1.6" target="1.6" compiler="javac1.6" nowarn="true" optimize="true" memoryinitialsize="256m" memorymaximumsize="512m">
<classpath refid="files-classpath" />
</javac>
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" />
<copydir dest="${build.classes}/com/dotmarketing/startup/runonce/sql" src="${src.dir}/com/dotmarketing/startup/runonce/sql"></copydir>
<copy todir="${build.classes}/org/apache/velocity/runtime/defaults/">
<fileset dir="${src.dir}/org/apache/velocity/runtime/defaults/"/>
</copy>
</target>
<target name="compile-anttasks" depends="prepare" description="Compiles source code need for clean and deploy plugins.">
<mkdir dir="${build.ant}" />
<javac encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" srcdir="${src.dir}" destdir="${build.ant}"
source="1.6" target="1.6" compiler="javac1.6" nowarn="true" optimize="true"
memoryinitialsize="256m" memorymaximumsize="512m" >
<classpath refid="files-classpath" />
<include name="com/dotmarketing/plugin/ant/**"/>
<include name="com/dotmarketing/plugin/util/**"/>
</javac>
</target>
<target name="compile-log4jappends" depends="prepare" description="Compiles source code need for our async appender.">
<mkdir dir="${build.log4j}" />
<javac debug="true" encoding="UTF-8" debuglevel="lines,vars,source" fork="true" srcdir="${src.dir}" destdir="${build.log4j}"
source="1.6" target="1.6" compiler="javac1.6" nowarn="true" optimize="true"
memoryinitialsize="256m" memorymaximumsize="512m" >
<classpath refid="files-classpath" />
<include name="org/apache/log4j/appender/**"/>
</javac>
</target>
<target name="checkWindows">
<condition property="isWindows">
<os family="windows" />
</condition>
</target>
<target name="jar" depends="compile" description="Generates dotcms.jar in the 'lib' directory.">
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" />
<copydir dest="${build.classes}/com/dotmarketing/startup/runonce/sql" src="${src.dir}/com/dotmarketing/startup/runonce/sql"></copydir>
<copy file="${src.dir}/com/liferay/portal/util/build.properties" tofile="${build.classes}/com/liferay/portal/util/build.properties" />
<jar jarfile="${build.lib}/dotcms_${dotcms.release.version}.jar" basedir="${build.classes}" >
<exclude name="com/dotmarketing/plugin/ant/**"/>
<exclude name="com/dotmarketing/plugin/util/**"/>
</jar>
</target>
<target name="jar-with-tests" depends="compile, compile-tests" description="Generates dotcms.jar in the 'lib' directory includind tests classes.">
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSSeq_NOSQLGEN.hbm.xml" />
<copy file="${src.dir}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" tofile="${build.classes}/com/dotmarketing/beans/DotCMSId_NOSQLGEN.hbm.xml" />
<copydir dest="${build.classes}/com/dotmarketing/startup/runonce/sql" src="${src.dir}/com/dotmarketing/startup/runonce/sql"></copydir>
<copy file="${src.dir}/com/liferay/portal/util/build.properties" tofile="${build.classes}/com/liferay/portal/util/build.properties" />
<jar jarfile="${build.lib}/dotcms_${dotcms.release.version}.jar" basedir="${build.classes}" >
<exclude name="com/dotmarketing/plugin/ant/**"/>
<exclude name="com/dotmarketing/plugin/util/**"/>
</jar>
</target>
<target name="jar-anttasks" depends="compile-anttasks" description="Generates dotcms-ant.jar in the 'lib' directory.">
<jar jarfile="${build.lib}/dotcms_ant.jar" basedir="${build.ant}"/>
</target>
<target name="jar-log4jtasks" depends="compile-log4jappends" description="Generates dotcms-log4j.jar in the 'tomcat/lib' directory.">
<jar jarfile="${build.lib}/dotcms_log4j.jar" basedir="${build.log4j}"/>
</target>
<!-- Configure the directory into which the web application is built -->
<property name="build" value="build" />
<!-- Configure the folder and context path for this application -->
<property name="webapp" value="dotCMS" />
<property name="path" value="/dotCMS" />
<property name="webapp.path" value="${build}/webapp${path}" />
<target name="deploy-config" >
<copy todir="${classes.app}">
<fileset dir="${src.conf.dir}">
<exclude name="**/.svn" />
</fileset>
</copy>
</target>
<target name="deploy-core" depends="jsp,jar,buildseqsql,buildmXsql,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}.jar" />
<!-- Freetts -->
<delete dir="${build.classes}" />
</target>
<target name="deploy-core-with-tests" depends="jsp,jar-with-tests,buildseqsql,buildmXsql,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}.jar" />
<!-- Freetts -->
<delete dir="${build.classes}" />
</target>
<target name="build-core" depends="jsp,jar,buildseqsql,buildmXsql" description="will compile, build sql scripts and update the about page of the site" />
<target name="build-core-no-jsp" depends="jar,buildseqsql,buildmXsql" description="will compile, build sql scripts and update the about page of the site" />
<target name="deploy-no-jsp" depends="jar,buildseqsql,buildmXsql,deploy-config" description="will compile, jar and copy to server lib and update the about page of the site">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_*.jar" excludes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_${dotcms.release.version}.jar" tofile="${deploy.dir}/dotcms_${dotcms.release.version}.jar" />
<antcall target="deploy-plugins" />
</target>
<target name="deploy-anttasks" depends="jar-anttasks" description="builds and deploys core and plugins">
<delete>
<fileset dir="${deploy.dir}" includes="dotcms_ant.jar" />
</delete>
<copy file="${build.lib}/dotcms_ant.jar" tofile="${deploy.dir}/dotcms_ant.jar" />
</target>
<target name="rep">
<loadfile property="generated.web"
srcFile="dotCMS/WEB-INF/generated_web.xml"/>
<replaceregexp flags="s" match="<!-- BEGIN JSPS -->(.*)<!-- END JSPS -->"
replace="<!-- BEGIN JSPS --> ${generated.web} <!-- END JSPS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
</target>
<target name="cleanrep">
<replaceregexp flags="s" match="<!-- BEGIN JSPS -->(.*)<!-- END JSPS -->"
replace="<!-- BEGIN JSPS --> XXX <!-- END JSPS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
</target>
<target name="jsp" depends="compile">
<taskdef classname="com.dotmarketing.util.jasper.DotJasperTask" name="jasper2" >
<classpath id="jspc.classpath" refid="files-classpath">
</classpath>
</taskdef>
<jasper2
validateXml="false"
uriroot="dotCMS"
javaEncoding="UTF-8"
webXmlFragment="dotCMS/WEB-INF/generated_web.xml"
outputDir="${src.jsp}/">
</jasper2>
<javac debug="true" debuglevel="lines,vars,source" encoding="UTF-8"
fork="true" srcdir="${src.jsp}" destdir="${build.classes}" source="1.6"
target="1.6" compiler="javac1.6" nowarn="true" optimize="true"
memoryinitialsize="256m" memorymaximumsize="512m">
<classpath refid="files-classpath" />
</javac>
<loadfile property="generated.web"
srcFile="dotCMS/WEB-INF/generated_web.xml"/>
<replaceregexp flags="s" match="<!-- BEGIN JSPS -->(.*)<!-- END JSPS -->"
replace="<!-- BEGIN JSPS --> ${generated.web} <!-- END JSPS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
</target>
<target name="buildsql" depends="buildseqsql, buildmXsql">
</target>
<target name="buildseqsql" depends="compile" description="builds the oracle and postgresql sql schema for dotcms. also leaves Inode.hbm.xml in a state for sequence databases">
<taskdef name="buildSQLTask" classname="com.dotmarketing.db.DotSQLGeneratorTask" >
<classpath>
<path refid="files-classpath" />
</classpath>
</taskdef>
<buildSQLTask dialect="net.sf.hibernate.dialect.PostgreSQLDialect" />
<buildSQLTask dialect="net.sf.hibernate.dialect.OracleDialect" />
<concat destfile="${build.dir}/sql/postgres.sql" fixlastline="yes">
<fileset dir="${sql.liferay.dir}" includes="${sql.liferay.postgres}" />
<fileset dir="${sql.quartz.dir}" includes="${sql.quartz.postgres}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.postgres}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.extra.postgres}" />
</concat>
<concat destfile="${build.dir}/sql/oracle.sql" fixlastline="yes">
<fileset dir="${sql.liferay.dir}" includes="${sql.liferay.oracle}" />
<fileset dir="${sql.quartz.dir}" includes="${sql.quartz.oracle}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.oracle}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.extra.oracle}" />
</concat>
<replaceregexp byline="true" file="${build.dir}/sql/oracle.sql">
<regexp pattern="nclob_description" />
<substitution expression="long_description" />
</replaceregexp>
<copy file="${build.dir}/sql/oracle.sql" todir="${classes.app}"/>
<copy file="${build.dir}/sql/postgres.sql" todir="${classes.app}"/>
</target>
<target name="buildmXsql" depends="compile" description="builds the mssql and mysql sql schema for dotcms. Leaves Inode.hbm.xml in a state for mssql/mysql">
<taskdef name="buildSQLTask" classname="com.dotmarketing.db.DotSQLGeneratorTask">
<classpath>
<path refid="files-classpath" />
</classpath>
</taskdef>
<buildSQLTask dialect="net.sf.hibernate.dialect.MySQLDialect" />
<buildSQLTask dialect="net.sf.hibernate.dialect.SybaseDialect" />
<concat destfile="${build.dir}/sql/mssql.sql" fixlastline="yes">
<fileset dir="${sql.liferay.dir}" includes="${sql.liferay.mssql}" />
<fileset dir="${sql.quartz.dir}" includes="${sql.quartz.mssql}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.mssql}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.extra.mssql}" />
</concat>
<concat destfile="${build.dir}/sql/mysql.sql" fixlastline="yes">
<fileset dir="${sql.liferay.dir}" includes="${sql.liferay.mysql}" />
<fileset dir="${sql.quartz.dir}" includes="${sql.quartz.mysql}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.mysql}" />
<fileset dir="${sql.dotcms.dir}" includes="${sql.dotcms.extra.mysql}" />
</concat>
<replace file="${build.dir}/sql/mysql.sql">
<replacetoken>VARCHAR(1)</replacetoken>
<replacevalue>tinyint(1)</replacevalue>
</replace>
<replace file="${build.dir}/sql/mysql.sql">
<replacetoken>varchar(1)</replacetoken>
<replacevalue>tinyint(1)</replacevalue>
</replace>
<mkdir dir="dotCMS/WEB-INF/classes"/>
<copy file="${build.dir}/sql/mysql.sql" todir="${classes.app}"/>
<copy file="${build.dir}/sql/mssql.sql" todir="${classes.app}"/>
</target>
<target name="create-dist" description="creates a zip file for dbs that autoincrement like MSSQL and MySQL distribution">
<antcall target="clean" />
<antcall target="deploy-core" />
<!--dotserver code (./dotserver)-->
<copy todir="${distribution.dotserver.output}">
<fileset dir=".">
<exclude name="**/.git" />
<exclude name=".git" />
<exclude name=".git/**" />
<exclude name="tomcat/logs/**" />
<exclude name="dotCMS/WEB-INF/dotlucene/**" />
<exclude name="dotCMS/assets/**" />
<exclude name="dotCMS/dotsecure/**" />
<exclude name="bin/autoupdater/**" />
<exclude name="dotCMS/html/js/dojo/src/**" />
<exclude name="tomcat/temp/**" />
<exclude name="build/**" />
<exclude name="tomcat/work/**" />
<exclude name="src/**" />
<exclude name="test/**" />
<exclude name=".*" />
<exclude name=".settings/**" />
</fileset>
</copy>
<mkdir dir="${distribution.dotserver.output}/tomcat/logs" />
<mkdir dir="${distribution.dotserver.output}/tomcat/temp" />
<!--autoupdater code (./autoupdater)-->
<copy todir="${distribution.autoupdater.output}">
<fileset dir="bin/autoupdater"/>
</copy>
<antcall target="javadoc" />
<zip destfile="${distribution.output}/../dotcms_${dotcms.release.version}.zip" basedir="${distribution.output}" />
<delete dir="${distribution.output}" />
</target>
<target name="create-update-dist" description="creates a zip file for dbs that autoincrement like MSSQL and MySQL distribution">
<antcall target="clean" />
<antcall target="deploy-core" />
<!--dotserver code (./dotserver)-->
<copy todir="${distribution.dotserver.output}">
<fileset dir=".">
<exclude name="**/.git" />
<exclude name=".git" />
<exclude name=".git/**" />
<exclude name="tomcat/logs/**" />
<exclude name="dotCMS/WEB-INF/dotlucene/**" />
<exclude name="dotCMS/assets/**" />
<exclude name="dotCMS/dotsecure/**" />
<exclude name="bin/autoupdater/**" />
<exclude name="dotCMS/html/js/dojo/src/**" />
<exclude name="tomcat/temp/**" />
<exclude name="build/**" />
<exclude name="tomcat/work/**" />
<exclude name="src/**" />
<exclude name="test/**" />
<exclude name=".*" />
<exclude name=".settings/**" />
<exclude name="dotCMS/starter.zip" />
</fileset>
</copy>
<mkdir dir="${distribution.dotserver.output}/tomcat/logs" />
<mkdir dir="${distribution.dotserver.output}/tomcat/temp" />
<!--autoupdater code (./autoupdater)-->
<copy todir="${distribution.autoupdater.output}">
<fileset dir="bin/autoupdater"/>
</copy>
<antcall target="javadoc" />
<zip destfile="${distribution.output}/../dotcms_${dotcms.release.version}.zip" basedir="${distribution.output}" />
<delete dir="${distribution.output}" />
</target>
<target name="javadoc" description="creates javadoc for dotCMS">
<javadoc maxmemory="1024m" packagenames="com.dotmarketing.*,com.dotcms.*" classpath="lib.app" sourcepath="${src.dir}" excludepackagenames="com.dummy.test.doc-files.*" defaultexcludes="yes" destdir="dotCMS/api" author="true" version="true" use="true" windowtitle="dotCMS API">
<classpath refid="files-classpath" />
<doctitle>
<![CDATA[
<h1>dotCMS 2.1 API Specification</h1>
]]>
</doctitle>
<bottom>
<![CDATA[<i>Copyright © 2012 dotCMS Inc. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:" />
</javadoc>
</target>
<target name="deleteliferayjsps">
<delete dir="dotCMS/html/portlet">
<exclude name="ext**" />
<exclude name="admin/**" />
<exclude name="my_account/**" />
</delete>
</target>
<target name="war-file" description="builds dotCMS as a war">
<mkdir dir="${build.war}"/>
<zip destfile="${build.war}/${war.name}.war">
<zipfileset dir="dotCMS/" >
<exclude name="**/.svn"/>
<exclude name="assets/"/>
<exclude name="WEB-INF/backup/"/>
<exclude name="WEB-INF/dotlucene/"/>
<exclude name="dot_secure/"/>
<exclude name="dotsecure/"/>
</zipfileset>
</zip>
</target>
<target name="war-no-jsp" depends="deploy-no-jsp,deploy-plugins" description="builds dotCMS as a war without the jsps precompiled">
<antcall target="war-file"/>
</target>
<target name="war" depends="deploy-core,deploy-plugins" description="builds dotCMS as a war without the jsps precompiled">
<antcall target="war-file"/>
</target>
<!-- Unit testing and code coverage -->
<path id="emma.lib" >
<pathelement location="dotCMS/WEB-INF/lib/emma.jar" />
<pathelement location="dotCMS/WEB-INF/lib/emma_ant.jar" />
</path>
<property name="instrumented.dir" value="build/instrumented" />
<property name="coverage.dir" value="build/coverage" />
<property name="tests.dir" value="build/tests" />
<target name="instrument-classes" depends="">
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<delete dir="${instrumented.dir}"/>
<delete file="${coverage.dir}/metadata.emma"/>
<mkdir dir="${instrumented.dir}"/>
<emma enabled="true" >
<instr instrpathref="build-classpath"
destdir="${instrumented.dir}"
metadatafile="${coverage.dir}/metadata.emma"
merge="true">
<filter value="com.dotmarketing.*"/>
<filter excludes="*Test, *Exception"/>
</instr>
</emma>
</target>
<taskdef resource="cactus.tasks">
<classpath>
<pathelement location="${lib.app}/cactus.core.framework.uberjar.javaEE.14-1.8.0.jar"/>
<pathelement location="${lib.app}/cactus.integration.shared.api-1.8.0.jar"/>
<pathelement location="${lib.app}/cactus.integration.ant-1.8.0.jar"/>
<pathelement location="${lib.app}/cargo-ant-0.9.jar"/>
<pathelement location="${lib.app}/cargo-core-uberjar-0.9.jar"/>
<pathelement location="${lib.app}/lib/commons-httpclient-3.1.jar"/>
<pathelement location="${lib.app}/lib/commons-logging-1.1.1.jar"/>
<pathelement location="${lib.app}/lib/aspectjrt-1.5.3.jar"/>
</classpath>
</taskdef>
<target name="drop-create-db-test" depends="set-properties, drop-db, create-db"/>
<!-- Main test target, this tasks will run all the unit tests of the application -->
<target name="test-dotcms" depends="deploy-tests, drop-create-db-test">
<runservertests
testurl="http://localhost:${server.port}"
starttarget="tomcat-start"
stoptarget="tomcat-stop"
testtarget="test-all-junits"/>
<antcall target="restore-files"/>
<!--<antcall target="drop-db"/>-->
</target>
<!-- Hit the tests servlet to run all the unit tests of the application -->
<target name="test-all-junits" depends="">
<condition property="get.ok">
<http url="${server.test.url}" errorsbeginat="400">
</http>
</condition>
<fail unless="get.ok" message="One or more tests failed!!!" />
<echo message="dotCMS successfully tested"/>
</target>
<target name="tomcat-start" >
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
<jvmarg value="-Dcatalina.home=tomcat"/>
<jvmarg value="-Xms1G"/>
<jvmarg value="-XX:MaxPermSize=512m"/>
<arg value="start"/>
<classpath>
<fileset dir="tomcat">
<include name="bin/bootstrap.jar"/>
</fileset>
</classpath>
</java>
</target>
<target name="tomcat-stop">
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
<jvmarg value="-Dcatalina.home=tomcat"/>
<arg value="stop"/>
<classpath>
<fileset dir="tomcat">
<include name="bin/bootstrap.jar"/>
</fileset>
</classpath>
</java>
</target>
<!-- Creates an empty db. Attributes are defined in the build.properties file -->
<target name="create-db" >
<sql driver="${db.driver}"
url="${db.base.url}"
userid="${db.username}"
password="${db.password}"
autocommit="true"
classpathref="files-classpath">
DROP DATABASE IF EXISTS ${db.name};
CREATE DATABASE ${db.name};
</sql>
</target>
<!-- Drops the test db. Attributes are defined in the build.properties file -->
<target name="drop-db" >
<sql driver="${db.driver}"
url="${db.base.url}"
userid="${db.username}"
password="${db.password}"
autocommit="true"
classpathref="files-classpath">
DROP DATABASE IF EXISTS ${db.name};
</sql>
</target>
<!-- Prepare and relocate the server.xml and ROOT.xml used for the test while backing up the originals -->
<!-- The db attributes and tomcat port is defined in the build.properties file -->
<target name="set-properties" depends="">
<move file="tomcat/conf/server.xml" tofile="${src.tests.dir}/server-orig.bck"/>
<move file="tomcat/conf/Catalina/localhost/ROOT.xml" tofile="${src.tests.dir}/ROOT-orig.bck"/>
<copy file="${src.tests.dir}/server.xml" todir="tomcat/conf"/>
<copy file="${src.tests.dir}/ROOT.xml" todir="tomcat/conf/Catalina/localhost"/>
<replace file="tomcat/conf/server.xml" token="{port}" value="${server.port}"/>
<replace file="tomcat/conf/Catalina/localhost/ROOT.xml">
<replacefilter token="{driver}" value="${db.driver}"/>
<replacefilter token="{url}" value="${db.url}"/>
<replacefilter token="{username}" value="${db.username}"/>
<replacefilter token="{password}" value="${db.password}"/>
</replace>
</target>
<!-- Reestablish the original server.xml and ROOT.xml files -->
<target name="restore-files" depends="">
<move file="${src.tests.dir}/server-orig.bck" tofile="tomcat/conf/server.xml" overwrite="true"/>
<move file="${src.tests.dir}/ROOT-orig.bck" tofile="tomcat/conf/Catalina/localhost/ROOT.xml" overwrite="true"/>
</target>
<target name="start-server-for-tests" depends="">
<mkdir dir="${coverage.dir}"/>
<copy file="tomcat/conf/server.xml" tofile="tomcat/conf/server-orig.xml" overwrite="true"/>
<copy file="tomcat/conf/server-tests.xml" tofile="tomcat/conf/server.xml" overwrite="true"/>
<exec osfamily="unix" executable="${basedir}/tomcat/bin/catalina.sh">
<arg value="tests"/>
</exec>
<exec osfamily="windows" executable="${basedir}/tomcat/bin/catalina.bat">
<arg value="start"/>
</exec>
<echo message="server starting">
</echo>
<sleep seconds="30"/>
</target>
<target name="shutdown-server-for-tests">
<exec osfamily="unix" executable="${basedir}/tomcat/bin/catalina.sh">
<arg value="stop"/>
</exec>
<exec osfamily="windows" executable="${basedir}/tomcat/bin/catalina.bat">
<arg value="stop"/>
</exec>
<echo message="server going down">
</echo>
<sleep seconds="10"/>
<move file="tomcat/conf/server-orig.xml" tofile="tomcat/conf/server.xml" overwrite="true"/>
</target>
<target name="generate-coverage-reports">
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<emma enabled="true" >
<report sourcepath="${src.dir}"
sort="+block,+name,+method,+class"
metrics="method:70,block:80,line:80,class:100">
<fileset dir="${coverage.dir}" >
<include name="*.emma" />
</fileset>
<txt outfile="${coverage.dir}/coverage.txt" depth="package" columns="class,method,block,line,name" />
<xml outfile="${coverage.dir}/coverage.xml" depth="package" />
<html outfile="${coverage.dir}/coverage.html" depth="method" columns="name,class,method,block,line" />
</report>
</emma>
</target>
<target name="compile-tests" depends="prepare,compile,deploy-config" description="Compiles all test source code.">
<javac encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" srcdir="${src.tests.dir}" destdir="${build.classes}" source="1.6" target="1.6" compiler="javac1.6" nowarn="true" optimize="true" memoryinitialsize="256m" memorymaximumsize="512m">
<classpath refid="files-classpath" />
</javac>
<copy todir="${build.classes}">
<fileset dir="${src.tests.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="tests" depends="compile, buildsql, buildmXsql, compile-tests, instrument-classes, start-server-for-tests" description="runs unit tests">
<mkdir dir="${tests.dir}" />
<mkdir dir="${tests.dir}/report/html" />
<junit printsummary="yes" haltonfailure="no" failureproperty="tests.failed">
<classpath>
<path refid="files-classpath">
</path>
<path path="${classes.app}">
</path>
</classpath>
<formatter type="xml" />
<test name="com.dotmarketing.DotcmsTestSuite" haltonfailure="no" outfile="${tests.dir}/test-dotcms.results">
</test>
</junit>
<antcall target="shutdown-server-for-tests">
</antcall>
<antcall target="generate-coverage-reports">
</antcall>
<junitreport todir="${tests.dir}/report/html">
<fileset dir="${tests.dir}">
<include name="test-*.xml"/>
</fileset>
<report format="frames" todir="${tests.dir}/report/html"/>
</junitreport>
<delete dir="${instrumented.dir}" />
<fail if="tests.failed"/>
</target>
<target name="uncomment-test-servlet" description="By default we need ServletTestRunner to be commented in web.xml so deployments doesn't have /servlet/test as a public endpoint.">
<!--Comment-->
<replaceregexp flags="s" match="<!-- TEST FRAMEWORK SERVLETS -->"
replace="<!-- TEST FRAMEWORK SERVLETS ">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<replaceregexp flags="s" match="<!-- END OF TEST FRAMEWORK SERVLETS -->"
replace="END OF TEST FRAMEWORK SERVLETS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<!--Uncomment-->
<replaceregexp flags="s" match="<!-- TEST FRAMEWORK SERVLETS"
replace="<!-- TEST FRAMEWORK SERVLETS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
<replaceregexp flags="s" match="END OF TEST FRAMEWORK SERVLETS -->"
replace="<!-- END OF TEST FRAMEWORK SERVLETS -->">
<fileset dir="dotCMS/WEB-INF/">
<include name="web.xml"/>
</fileset>
</replaceregexp>
</target>
<!--Plugin tasks-->
<target name="build" depends="build-core,build-plugins" description="build the dotCMS core and plugins" />
<target name="deploy" depends="build, deploy-core, deploy-plugins" description="builds and deploys core and plugins" />
<target name="deploy-tests" depends="uncomment-test-servlet, build, deploy-core-with-tests, deploy-plugins" description="builds and deploys core, plugins and unit tests" />
<target name="deploy-dev" depends="deploy-plugins"/>
<target name="clean" depends="clean-plugins,undeploy-plugins,clean-core,clean-tinymce-gz" description="cleans plugins, core and undeploys plugins" />
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<fileset dir="plugins" includes="*/build.xml"/>
</subant>
</sequential>
</macrodef>
<target name="build-plugins" description="builds plugins but does not deploy">
<iterate target="build"/>
</target>
<target name="clean-plugins" description="undeploys and cleans plugins" depends="undeploy-plugins">
<iterate target="clean"/>
</target>
<target name="unbuild-plugins" description="cleans plugins">
<iterate target="clean"/>
</target>
<target name="-check-use-file">
<available property="file.exists" file="build.properties"/>
</target>
<target name="use-file" depends="-check-use-file" if="file.exists">
<loadproperties srcFile="build.properties"/>
</target>
<target name="setup-deploy-location" depends="use-file" description="sets up the locations where to deploy">
<condition property="plugin.root.dir" value="${target.root}" else="${plugin.root.dir.default}">
<isset property="target.root"/>
</condition>
<condition property="plugin.jar.deploy.dir" value="${target.root}/WEB-INF/lib" else="${plugin.root.dir.default}/WEB-INF/lib">
<isset property="target.root"/>
</condition>
<echo>Deploying plugins to: ${plugin.root.dir} | ${plugin.jar.deploy.dir}</echo>
</target>
<target name="deploy-plugins" depends="build-plugins,setup-deploy-location" description="builds and deploys plugins">
<echo>Copying plugins to: ${plugin.root.dir}</echo>
<copy todir="${plugin.root.dir}/WEB-INF/classes" file="plugins/plugins.xml" />
<subant target="deploy-plugin" genericantfile="${basedir}/build.xml">
<dirset dir="plugins" includes="*"/>
<property name="plugin.root.dir" value="${plugin.root.dir}"/>
<property name="plugin.jar.deploy.dir" value="${plugin.jar.deploy.dir}"/>
</subant>
<taskdef classname="com.dotmarketing.plugin.ant.DeployTask" name="plugin-deploy-task">
<classpath id="plugin-deploy-task.classpath" refid="ant-files-classpath">
</classpath>
</taskdef>
<echo>Deploying plugins from: ${plugin.root.dir}</echo>
<plugin-deploy-task root="${plugin.root.dir}" plugins="${plugin.root.dir}/WEB-INF/lib"/>
</target>
<target name="deploy-plugin">
<copy todir="${plugin.jar.deploy.dir}">
<fileset dir="build/jar/" />
</copy>
</target>
<target name="undeploy-plugins" depends="setup-deploy-location" description="undeploys all plugins, returns overridden files to default state">
<taskdef classname="com.dotmarketing.plugin.ant.UndeployTask" name="plugin-undeploy-task">
<classpath id="plugin-deploy-task.classpath" refid="ant-files-classpath">
</classpath>
</taskdef>
<plugin-undeploy-task root="${plugin.root.dir}" plugins="${plugin.root.dir}/WEB-INF/lib"/>
<delete>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/plugin-*.jar"/>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/pluginlib-*.jar"/>
</delete>
<delete file="${plugin.root.dir}/WEB-INF/classes/plugins.xml" />
<delete dir="${plugin.root.dir}/html/plugins" failonerror="false" />
<antcall target="deploy-config" />
</target>
<target name="clean-plugins-libs" depends="setup-deploy-location">
<delete>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/plugin-*.jar"/>
<fileset dir="${plugin.root.dir}/WEB-INF/lib" includes="**/pluginlib-*.jar"/>
</delete>
</target>
<target name="check-src-build" description="Checks to see if a build-core is possible. Fails if the src directory is missing or if the autoupdater is present. This prevents sourceless installs from running a clean" >
<available file="${src.dir}/com/dotmarketing" type="dir" property="src.dir.present" />
<fail message="Source directory not present. If trying to deploy plugins, please use bin/deploy-plugins.sh or bin/deploy-plugins.bat instead" unless="src.dir.present" />
<available file="bin/autoUpdater.jar" type="file" property="autoupdater.present" />
<fail message="Autoupdater present. If trying to deploy plugins, please use bin/deploy-plugins.sh or bin/deploy-plugins.bat instead" if="autoupdater.present" />
</target>
<!--AUTO UPDATER -->
<path id="autoupdater-classpath">
<fileset dir="${basedir}/bin/autoupdater/libs">
<include name="**/*.jar" />
</fileset>
</path>
<target name="build-autoupdater-classpath">
<manifestclasspath property="autoupdater-jar-cp" jarfile="${dist.autoupdater}/autoUpdater.jar">
<classpath refid="autoupdater-classpath" />
</manifestclasspath>
</target>
<target name="clean-autoupdater">
<delete file="${dist.autoupdater}/autoUpdater.jar" failonerror="false" />
<delete dir="${build.autoupdater}" failonerror="false"/>
</target>
<target name="compile-autoupdater" depends="prepare" description="Compiles autoupdater source.">
<mkdir dir="${build.autoupdater}" />
<javac encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" srcdir="${src.dir}" destdir="${build.autoupdater}"
source="1.6" target="1.6" compiler="javac1.6" nowarn="true" optimize="true"
memoryinitialsize="256m" memorymaximumsize="512m" >
<classpath refid="files-classpath" />
<include name="com/dotcms/autoupdater/**"/>
</javac>
<copy file="${src.dir}/com/dotcms/autoupdater/update.properties" tofile="${build.autoupdater}/com/dotcms/autoupdater/update.properties" />
<copy file="${src.dir}/com/dotcms/autoupdater/messages.properties" tofile="${build.autoupdater}/com/dotcms/autoupdater/messages.properties" />
</target>
<target name="jar-autoupdater" depends="compile-autoupdater,build-autoupdater-classpath" description="Generates autoUpdater.jar in the 'autoupdater/dist' directory.">
<jar jarfile="${dist.autoupdater}/autoUpdater.jar" basedir="${build.autoupdater}">
<manifest>
<attribute name="Main-Class" value="com.dotcms.autoupdater.UpdateAgent"/>
<attribute name="Agent-Version" value="${agent.version}"/>
<attribute name="Release-Version" value="${dotcms.release.version}"/>
<attribute name="Class-Path" value="${autoupdater-jar-cp}"/>
</manifest>
</jar>
</target>
</project>