-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.xml
895 lines (783 loc) · 36.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
<!--
/***************************************************************************
* *
* Organization: Earth System Grid Federation *
* *
****************************************************************************
* *
* Copyright (c) 2009, Lawrence Livermore National Security, LLC. *
* Produced at the Lawrence Livermore National Laboratory *
* LLNL-CODE-420962 *
* *
* All rights reserved. This file is part of the: *
* Earth System Grid (ESG) Data Node Software Stack, Version 1.0 *
* *
* For details, see http://esg-repo.llnl.gov/esg-node/ *
* Please also read this link *
* http://esg-repo.llnl.gov/LICENSE *
* *
* * Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* conditions are met: *
* *
* * Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the disclaimer below. *
* *
* * Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the disclaimer (as noted below) *
* in the documentation and/or other materials provided with the *
* distribution. *
* *
* Neither the name of the LLNS/LLNL nor the names of its contributors *
* may be used to endorse or promote products derived from this *
* software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE *
* LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR *
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF *
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, *
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT *
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE. *
* *
***************************************************************************/
/**
Description:
This is the ant build file for the esg-search project. This
file should not be modified. A user may set the values of the
properties used in this file by defining the property file
$HOME/.esg-search.ant.properties which will override the values set
here. An example of such a file is located in this etc directory.
NOTE:
If you get this error:
BUILD FAILED
java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.getFileUtils()L
org/apache/tools/ant/util/FileUtils;
It means somewhere in your system and/or classpath is an old ANT clobbering
the one you want to run. Use the "-noclasspath" flag in the ant command.
**/
-->
<!--
Description:
Builds the project via ant (obviously).
-->
<project name="esg-search" default="make" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="module" value="esg-search"/>
<property name="organization" value="Earth Systems Grid Federation"/>
<property name="project_name" value="ESG-Search"/>
<property name="author" value="Luca Cinquini"/>
<!--
************************************************************
Global Initialization and Preparation....
************************************************************
-->
<property file="${user.home}/.${module}.ant.properties"/>
<echo message="user property file ${user.home}/.${module}.ant.properties"/>
<property file="${user.home}/.esgf.ant.properties"/>
<echo message="user property file ${user.home}/.esgf.ant.properties"/>
<property file="${basedir}/etc/${module}.ant.properties"/>
<echo message="user property file ${basedir}/etc/${module}.ant.properties"/>
<exec executable="bash" dir="${basedir}" outputproperty="version_num">
<arg value="-c"/>
<arg value="git describe | sed -n 's/v[.]*\([a-zA-Z0-9.]*\)[-]*.*/\1/p'"/>
</exec>
<exec executable="bash" dir="${basedir}" outputproperty="branch">
<arg value="-c"/>
<arg value="git branch | grep '*' | sed -n 's/\*[ ]*//p'"/>
</exec>
<exec executable="bash" dir="${basedir}" outputproperty="commit">
<arg value="-c"/>
<arg value="git describe"/>
</exec>
<exec executable="bash" dir="${basedir}" outputproperty="release_name">
<arg value="-c"/>
<arg value="git tag | sed 's/^v//' | sort -s -t. -k1,1n -k2,2n -k3,3n | sed -ne 's/\([0-9]*\.[0-9]*\.[0-9]*\)-\([a-zA-Z0-9_-]*\)-release.*$/\2/p'| tail -n 1"/>
</exec>
<property name="ivy.esgf-repo-local.default.root.dir" value="${user.home}/.ivy2/local"/>
<property name="ivy_retrieve_type" value="jar, bundle"/>
<property name="filter" value="false"/>
<property name="java.version.val" value="1.8"/>
<!-- **static defines** -->
<property name="version_num" value="0.0.0"/>
<filter token="version_num" value="${version_num}"/>
<property name="branch" value="[nobranch]"/>
<filter token="branch" value="${branch}"/>
<property name="commit" value="ffffff"/>
<filter token="commit" value="${commit}"/>
<property name="release_name" value="no_name"/>
<filter token="release_name" value="${release_name}"/>
<filter token="module" value="${module}"/>
<property name="log_dir" value="${java.io.tmpdir}/${module}/logs"/>
<mkdir dir="${log_dir}" />
<filter token="log_dir" value="${log_dir}"/>
<property environment="env"/>
<!-- ****************** -->
<!--
************************************************************
Initialization and Preparation....
************************************************************
-->
<target name="pre-init" unless="build.master">
<property name="build.compiler" value="javac${java.version.val}" />
<property name="build.compiler.emacs" value="true" />
<echo message="set build.compiler to ${build.compiler}"/>
</target>
<!-- ********************************************************* -->
<target name="init" depends="pre-init" unless="build.master"
description="(View the properties defined in this file)">
<echo message="Initializing build environment..."/>
<echo message="Using Java Version ${java.version.val}"/>
<!-- defaults to use if local .${module}.ant.properties file does not exist -->
<property name="src_dir" value="${basedir}/src/java/main"/>
<property name="lib_dir" value="${basedir}/lib"/>
<property name="lib_fetched_dir" value="${basedir}/lib/fetched"/>
<property name="build_dir" value="${basedir}/build"/>
<property name="dist_dir" value="${basedir}/dist"/>
<property name="bin_dir" value="${basedir}/bin"/>
<property name="test_src_dir" value="${basedir}/src/java/test"/>
<property name="test_build_dir" value="${basedir}/build/test"/>
<property name="test_build_dir_inst" value="${basedir}/build/test-instrumented" />
<property name="etc_dir" value="${basedir}/etc"/>
<property name="conf_dir" value="${etc_dir}/conf"/>
<property name="rc_dir" value="${basedir}/resources"/>
<property name="web_dir" value="${basedir}/web"/>
<property name="doc_dir" value="${basedir}/docs"/>
<property name="depcache_dir" value="${java.io.tmpdir}/${module}/depcache"/>
<property name="log_config" value="${conf_dir}/log4j.properties"/>
<property name="log_file" value="${log_dir}/${module}_v${version_num}.log"/>
<property name="javadoc_link_src" value="false"/>
<property name="main_class" value="esg.search.Main"/>
<property name="doc_dir_generated" value="${basedir}/docs-generated"/>
<property name="jdoc_dir" value="${doc_dir_generated}/javadocs"/>
<property name="test_results_dir" value="${doc_dir_generated}/test-results"/>
<property name="test_reports_dir" value="${doc_dir_generated}/test-reports"/>
<property name="test_coverage_dir" value="${doc_dir_generated}/coverage-reports" />
<property name="lib_deps_reports_dir" value="${doc_dir_generated}/dep-reports"/>
<property name="jaxb_xsd_dir" value="${etc_dir}/xsd/"/>
<property name="jaxb_gen_src_dir" value="${src_dir}/esg/common/generated"/>
<property name="jaxb_gen_package" value="esg.common.generated"/>
<property name="test_last_failed_file" location="${build_dir}/.lasttestsfailed"/>
<property name="test_coverage_file" value="${basedir}/.cobertura.ser"/>
<property name="ivy.lib.dir" value="${lib_fetched_dir}"/>
<echo message="--------------------------------"/>
<echo message="module = ${module} "/>
<echo message="version_num = ${version_num} "/>
<echo message="release_name = ${release_name} "/>
<echo message="--------------------------------"/>
<echo message="src_dir = ${src_dir}"/>
<echo message="lib_dir = ${lib_dir}"/>
<echo message="lib_fetched_dir = ${lib_fetched_dir}"/>
<echo message="build_dir = ${build_dir}"/>
<echo message="dist_dir = ${dist_dir}"/>
<echo message="bin_dir = ${bin_dir}"/>
<echo message="test_src_dir = ${test_src_dir}"/>
<echo message="test_build_dir = ${test_build_dir}"/>
<echo message="etc_dir = ${etc_dir}"/>
<echo message="conf_dir = ${conf_dir}"/>
<echo message="web_dir = ${web_dir}"/>
<echo message="doc_dir = ${doc_dir}"/>
<echo message="depcache_dir = ${depcache_dir}"/>
<echo message="log_config = ${log_config}"/>
<echo message="log_file = ${log_file}"/>
<echo message="javadoc_link_src = ${javadoc_link_src}"/>
<echo message="--------------------------------"/>
<echo message="doc_dir_generated = ${basedir}/docs-generated"/>
<echo message="jdoc_dir = ${jdoc_dir}"/>
<echo message="test_results_dir = ${test_results_dir}"/>
<echo message="test_reports_dir = ${test_reports_dir}"/>
<echo message="test_coverage_dir = ${test_coverage_dir}"/>
<echo message="lib_deps_reports_dir = ${doc_dir_generated}/dep-reports"/>
<echo message="--------------------------------"/>
<tstamp/>
</target>
<!--
************************************************************
Library and Resource Dependencies...
************************************************************
-->
<target name="init-ivy" depends="init">
<property name="ivy_version" value="2.3.0" />
<!-- <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy_version}/ivy-${ivy_version}.jar"
dest="ivy-${ivy_version}.jar" usetimestamp="true"/> -->
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpath="${lib_dir}/ivy-${ivy_version}.jar"/>
<ivy:settings file="./ivysettings.xml">
<credentials host="devel.esgf.org" realm="Artifactory Realm" username="${username}" passwd="${passwd}" />
</ivy:settings>
</target>
<target name="deps" depends="init-ivy" description="(Sets up library dependencies: Ivy)">
<mkdir dir="${lib_fetched_dir}"/>
<ivy:resolve type="${ivy_retrieve_type}"/>
<ivy:retrieve sync="true"/>
<ivy:deliver deliverpattern="dist/[artifact]-[revision].[ext]"
pubrevision="${version_num}" status="milestone" />
<path id="main_classpath">
<fileset dir="${lib_dir}">
<include name="**/*.jar"/>
<exclude name="**/junit*.jar"/>
<exclude name="**/*javadoc.jar"/>
<exclude name="**/*sources.jar"/>
</fileset>
<pathelement path="${build_dir}"/>
</path>
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath refid="main_classpath"/>
</taskdef>
<echo message="MAIN CLASSPATH:"/>
<pathconvert property="_cp" refid="main_classpath" pathsep="${line.separator}"/>
<echo>${_cp}</echo>
<echo message="--------------------------------"/>
</target>
<target name="dep_report" depends="deps" description="(Generates a report of library dependencies)">
<mkdir dir="${lib_deps_reports_dir}"/>
<ivy:report todir="${lib_deps_reports_dir}"/>
</target>
<target name="dep_clean_cache" depends="init,init-ivy" description="(Cleans the Ivy cache)">
<ivy:cleancache />
</target>
<target name="dep_clean_libs" depends="init"
description="(Cleans out [removes] local workspace jars fetched by Ivy)">
<echo message="Removing local jars fetched by Ivy"/>
<delete dir="${lib_fetched_dir}"/>
</target>
<!--
************************************************************
Generation and Compilation....
************************************************************
-->
<target name="gen_jaxb" depends="deps"
description="(Generates Java Objects from XML schema)">
<mkdir dir="${jaxb_gen_src_dir}"/>
<xjc package="${jaxb_gen_package}"
destdir="${src_dir}"
removeOldOutput="yes"
readonly="yes">
<classpath refid="main_classpath"/>
<schema dir="${jaxb_xsd_dir}" includes="*.xsd"/>
<produces dir="${jaxb_gen_src_dir}" includes="*.java" />
</xjc>
</target>
<target name="make" depends="deps"
description="(Java compiles all the main source code)">
<echo message="Java compiling ${module}..."/>
<mkdir dir="${build_dir}" />
<mkdir dir="${depcache_dir}" />
<depend srcdir="${src_dir}"
destdir="${build_dir}"
cache="${depcache_dir}"
closure="yes"/>
<javac srcdir="${src_dir}"
destdir="${build_dir}"
includes="**/*.java"
excludes="**/no_comp/**,**/ignore/**,**/*_"
classpathref="main_classpath"
debug="on"
verbose="off"
includeantruntime="false"
nowarn="on">
<compilerarg value="-Xlint"/>
</javac>
<copy todir="${build_dir}" filtering="${filter}" overwrite="true">
<fileset dir="${conf_dir}" includes="**/*.properties,**/*.template,**/*.xml,**/*filter-web.xml"/>
<fileset dir="${src_dir}" includes="**/*.properties,**/*.template,**/*.xml"/>
</copy>
<tstamp/>
</target>
<target name="make_war" depends="make,init"
description="(Creates war file of this project)">
<mkdir dir="${dist_dir}" />
<mkdir dir="${dist_dir}/tmplib"/>
<copy todir="${dist_dir}/tmplib" overwrite="true" flatten="yes">
<fileset dir="${lib_dir}" includes="**/*.jar" excludes="**/*servlet-api*.jar,**/junit*.jar,**/*sources.jar,**/*javadoc.jar"/>
</copy>
<echo message="${conf_dir}"/>
<delete file="${dist_dir}/${module}.war"/>
<war destfile="${dist_dir}/${module}.war" webxml="${conf_dir}/${module}-web.xml">
<!-- <fileset dir="${web_dir}" excludes="WEB-INF/**/web.xml/**,**semantic.cache**"/> -->
<webinf dir="${conf_dir}" includes="**/*.xml,wget-template" excludes="${module}-web.xml,**/solr/**,**/jetty/**"/>
<lib dir="${dist_dir}/tmplib">
<include name="**/*.jar"/>
<exclude name="**/*-test*.jar,**/*-common*.jar"/>
</lib>
<classes dir="${build_dir}" excludes="**/test*/**,**/solr*/*.xml,**/jetty/**"/>
<manifest>
<attribute name="Organization" value="${organization}"/>
<attribute name="Author" value="${author}"/>
<attribute name="Project" value="${project_name} ${module}"/>
<attribute name="Module" value="${module}"/>
<attribute name="Version" value="${version_num}"/>
<attribute name="Branch" value="${branch}"/>
<attribute name="Commit" value="${commit}"/>
<attribute name="Release-Name" value="${release_name}"/>
</manifest>
</war>
<delete dir="${dist_dir}/tmplib"/>
</target>
<target name="make_web_dir" depends="make, init"
description="(Assembles the WEB-INF directory to run the web application in place.)">
<mkdir dir="${basedir}/WebContent" />
<mkdir dir="${basedir}/WebContent/WEB-INF" />
<property name="web_deploy_dir" value="${basedir}/WebContent/WEB-INF"/>
<!-- web configuration files -->
<copy file="${conf_dir}/${module}-web.xml" tofile="${web_deploy_dir}/web.xml"/>
<copy todir="${web_deploy_dir}">
<fileset dir="${conf_dir}" includes="**/*.xml, **/*.properties" excludes="**/${module}-web.xml"/>
</copy>
<!-- web views
<copy file="${web_dir}/index.jsp" tofile="${basedir}/WebContent/index.jsp"/>
<copy todir="${web_deploy_dir}/views">
<fileset dir="${web_dir}/WEB-INF/views" />
</copy> -->
<!-- web lib -->
<copy todir="${web_deploy_dir}/lib" flatten="true">
<fileset dir="${lib_dir}" includes="**/*.jar" excludes="**/junit*.jar,**/*sources.jar,**/*javadoc.jar"/>
</copy>
</target>
<!--
************************************************************
PREPARATION & PACKAGING....
************************************************************
-->
<target name="make_jar" depends="make"
description="(Creates the jar file distribution of this project)">
<echo message="JAR - ${build_dir} ->> ${dist_dir}/${module}-${version_num}.jar"/>
<delete>
<fileset dir="." includes="${dist_dir}/${module}-${version_num}.jar"/>
</delete>
<mkdir dir="${dist_dir}" />
<jar destfile="${dist_dir}/${module}-${version_num}.jar">
<fileset dir="${build_dir}"
includes="esg/**,**/*.properties"
excludes="**/test/**, **/log4j.properties"/>
<manifest>
<attribute name="Organization" value="${organization}"/>
<attribute name="Author" value="${author}"/>
<attribute name="Project" value="${project_name}"/>
<attribute name="Module" value="${module}"/>
<attribute name="Version" value="${version_num}"/>
<attribute name="Branch" value="${branch}"/>
<attribute name="Commit" value="${commit}"/>
<attribute name="Release-Name" value="${release_name}"/>
<attribute name="Main-Class" value="${main_class}"/>
<section name="esg/">
<attribute name="Sealed" value="false"/>
</section>
</manifest>
</jar>
</target>
<target name="make_common_jar" depends="make" description="(Creates common jar file)">
<echo message="JAR - ${test_build_dir} ->> ${dist_dir}/${module}-common-${version_num}.jar"/>
<delete>
<fileset dir="." includes="${dist_dir}/${module}-common*.jar"/>
</delete>
<mkdir dir="${dist_dir}" />
<jar destfile="${dist_dir}/${module}-common-${version_num}.jar">
<fileset dir="${build_dir}"
includes="esg/search/common/**"/>
<manifest>
<attribute name="Organization" value="${organization}"/>
<attribute name="Author" value="${author}"/>
<attribute name="Project" value="${project_name} ${module} common"/>
<attribute name="Module" value="${module}"/>
<attribute name="Version" value="${version_num}"/>
<attribute name="Branch" value="${branch}"/>
<attribute name="Commit" value="${commit}"/>
<attribute name="Release-Name" value="${release_name}"/>
<section name="esg/search/common/">
<attribute name="Sealed" value="false"/>
</section>
</manifest>
</jar>
</target>
<target name="make_fe_jar" depends="make"
description="(Creates the jar file distribution for client Front End GUI)">
<echo message="JAR - ${build_dir} ->> ${dist_dir}/${module}-fe-${version_num}.jar"/>
<delete>
<fileset dir="." includes="${dist_dir}/${module}-fe-${version_num}.jar"/>
</delete>
<mkdir dir="${dist_dir}" />
<jar destfile="${dist_dir}/${module}-fe-${version_num}.jar">
<fileset dir="${build_dir}"
includes="esg/search/**,esg/**/common/**,**/*.properties"
excludes="**/test/**,**/search.properties/**"/>
<manifest>
<attribute name="Organization" value="${organization}"/>
<attribute name="Author" value="${author}"/>
<attribute name="Project" value="${project_name}"/>
<attribute name="Module" value="${module} fe"/>
<attribute name="Version" value="${version_num}"/>
<attribute name="Branch" value="${branch}"/>
<attribute name="Commit" value="${commit}"/>
<attribute name="Release-Name" value="${release_name}"/>
<attribute name="Main-Class" value="${main_class}"/>
<section name="esg/search/">
<attribute name="Sealed" value="false"/>
</section>
</manifest>
</jar>
</target>
<target name="make_connector_jar" depends="make"
description="(Creates the jar file distribution for node connector component to search [non-java] component)">
<echo message="JAR - ${build_dir} ->> ${dist_dir}/${module}-connector-${version_num}.jar"/>
<delete>
<fileset dir="." includes="${dist_dir}/${module}-connector-${version_num}.jar"/>
</delete>
<mkdir dir="${dist_dir}" />
<jar destfile="${dist_dir}/${module}-connector-${version_num}.jar">
<fileset dir="${build_dir}"
includes="esg/**/connector/**,esg/**/common/**,**/*.properties"
excludes="**/test/**,**/search.properties/**"/>
<manifest>
<attribute name="Organization" value="${organization}"/>
<attribute name="Author" value="${author}"/>
<attribute name="Project" value="${project_name} ${module} connector"/>
<attribute name="Module" value="${module}"/>
<attribute name="Version" value="${version_num}"/>
<attribute name="Branch" value="${branch}"/>
<attribute name="Commit" value="${commit}"/>
<attribute name="Release-Name" value="${release_name}"/>
<section name="esg/node/search/connector/">
<attribute name="Sealed" value="false"/>
</section>
</manifest>
</jar>
</target>
<target name="make_all_jars" depends="make_jar,make_common_jar,make_fe_jar,make_connector_jar"/>
<target name="make_dist" depends="make_war,make_all_jars"
description="(Creates full software distribution)">
<delete file="${dist_dir}/${module}-${version_num}.tar.gz"/>
<tar destfile="${dist_dir}/${module}-${version_num}.tar">
<tarfileset dir="${dist_dir}" includes="**/*.jar,**/*.war" prefix="${module}-${version_num}"/>
<tarfileset dir="${basedir}" prefix="${module}-${version_num}">
<include name="LICENSE"/>
<include name="INSTALL"/>
<include name="README"/>
</tarfileset>
</tar>
<gzip destfile="${dist_dir}/${module}-${version_num}.tar.gz" src="${dist_dir}/${module}-${version_num}.tar"/>
<delete file="${dist_dir}/${module}-${version_num}.tar"/>
</target>
<!--
************************************************************
CLEANING....
************************************************************
-->
<target name="clean" depends="init"
description="(Cleans out classfiles from build dir)">
<echo message="Removing build directory"/>
<delete dir="${build_dir}"/>
<delete dir="${doc_dir_generated}"/>
<delete file="${test_coverage_file}"/>
<delete dir="${test_build_dir_inst}"/>
<tstamp/>
</target>
<target name="clean_dist" depends="init"
description="(Cleans out the distribution directory)">
<echo message="Cleaning out distribution directory"/>
<delete dir="${dist_dir}"/>
<tstamp/>
</target>
<target name="clean_local_repo" depends="init,init-ivy" description="(Cleans the local filesystem Ivy repo)">
<delete dir="${ivy.esgf-repo-local.default.root.dir}/org.esgf/${module}"/>
</target>
<target name="clean_test" depends="init"
description="(Cleans out the test build directory)">
<echo message="Cleaning out test build directory"/>
<delete dir="${test_build_dir}"/>
<tstamp/>
</target>
<target name="clean_jaxb" depends="init"
description="(Cleans out the JAXB generated Java source files!)">
<echo message="Removing JAXB generated Java source files"/>
<delete dir="${jaxb_gen_src_dir}"/>
</target>
<target name="clean_all"
depends="clean,clean_dist,clean_local_repo,clean_jaxb,dep_clean_libs"
description="(Cleans out generatable artifacts)"/>
<!--
************************************************************
JUnit Tests....
************************************************************
-->
<target name="make_test" depends="make"
description="(Java compiles all the test source code)">
<echo message="Java compiling ${module} TESTs..."/>
<path id="test_classpath">
<fileset dir="${lib_dir}" includes="**/junit*.jar"/>
<path refid="main_classpath"/>
<pathelement location="${test_build_dir}" />
</path>
<!--
<echo message="TEST CLASSPATH:"/>
<pathconvert property="test_cp" refid="test_classpath" pathsep="${line.separator}"/>
<echo>${test_cp}</echo>
-->
<echo message="--------------------------------"/>
<mkdir dir="${test_build_dir}" />
<mkdir dir="${depcache_dir}" />
<depend srcdir="${test_src_dir}"
destdir="${test_build_dir}"
cache="${depcache_dir}"
closure="yes"/>
<javac srcdir="${test_src_dir}"
destdir="${test_build_dir}"
excludes="**/no_comp/**,**/ignore/**,**/*_,**/*_*/**"
classpathref="test_classpath"
deprecation="true"
failonerror="true"
target="${java.version.val}"
debug="on"
verbose="off"
includeantruntime="false"
nowarn="on"/>
<tstamp/>
<copy todir="${test_build_dir}" filtering="${filter}" overwrite="true">
<fileset dir="${test_src_dir}" includes="**/*.properties,**/*.template,**/*.xml,**/*.ks"/>
</copy>
</target>
<target name="test_check">
<condition property="tests_uptodate">
<and>
<uptodate>
<srcfiles dir="${src_dir}" includes="**/*.java"/>
<mapper type="glob"
from="*.java"
to="${build_dir}/*.class" />
</uptodate>
<uptodate>
<srcfiles dir="${test_src_dir}" includes="**/*.java"/>
<mapper type="glob"
from="*.java"
to="${test_build_dir}/*.class" />
</uptodate>
<not>
<available file="${test_last_failed_file}"/>
</not>
<not>
<isset property="testcase"/>
</not>
</and>
</condition>
<echo message="tests_uptodate = ${tests_uptodate}"/>
</target>
<!--
To run a single test case...
EXAMPLE: ant test -Dtestcase=esg.node.search.connector.ESGsearchTest
(unless="tests_uptodate")
-->
<target name="test" depends="make_test,test_check"
description="(Runs unit tests: JUnit)">
<delete dir="${test_results_dir}" />
<mkdir dir="${test_results_dir}"/>
<delete dir="${test_reports_dir}" />
<mkdir dir="${test_reports_dir}"/>
<delete dir="${test_coverage_dir}" />
<mkdir dir="${test_coverage_dir}" />
<path id="coverage.classpath">
<fileset dir="${lib_dir}" includes="**/*.jar" />
<path refid="main_classpath" />
<pathelement location="${test_build_dir}" />
</path>
<taskdef resource="tasks.properties" classpathref="coverage.classpath" />
<!-- instrument classes -->
<cobertura-instrument todir="${test_build_dir_inst}" datafile="${test_coverage_file}">
<fileset dir="${build_dir}/esg">
<include name="**/*.class" />
</fileset>
</cobertura-instrument>
<!-- set test_classapth to see instrumented classes -->
<path id="test_classpath">
<pathelement location="${test_build_dir_inst}" />
<fileset dir="${lib_dir}" includes="**/junit*.jar" />
<path refid="main_classpath" />
<pathelement location="${test_build_dir}" />
</path>
<junit errorproperty="failed"
failureproperty="failed"
printsummary="on"
fork="yes"
maxmemory="1024M">
<sysproperty key="net.sourceforge.cobertura.datafile" value="${test_coverage_file}"/>
<classpath refid="test_classpath" />
<formatter type="plain" usefile="false"/>
<formatter type="xml" />
<test name="${testcase}" todir="${test_results_dir}" if="testcase"/>
<batchtest todir="${test_results_dir}" unless="testcase">
<fileset dir="${test_build_dir}" includes="**/*Test*.class"/>
</batchtest>
<assertions enableSystemAssertions="true">
<enable/>
</assertions>
</junit>
<junitreport todir="${test_results_dir}">
<fileset dir="${test_results_dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test_reports_dir}"/>
</junitreport>
<!-- coverage report -->
<cobertura-report format="html" srcdir="${src_dir}" destdir="${test_coverage_dir}" datafile="${test_coverage_file}"/>
<cobertura-report format="xml" srcdir="${src_dir}" destdir="${test_coverage_dir}/xml" datafile="${test_coverage_file}"/>
<echo message="last build failed tests" file="${test_last_failed_file}"/>
<fail if="failed" message="Unit tests failed. Check log or reports for details"/>
<delete file="${test_last_failed_file}"/>
</target>
<!--
************************************************************
DOCUMENTATION....
************************************************************
-->
<target name="docs" depends="init"
description="(Generates the javadoc for this project)">
<delete dir="${jdoc_dir}"/>
<mkdir dir="${jdoc_dir}" />
<javadoc
destdir="${jdoc_dir}"
author="true"
version="true"
use="true"
linksource="${javadoc_link_src}"
windowtitle="${module} api"
classpathref="main_classpath">
<packageset dir="${src_dir}" defaultexcludes="yes">
<exclude name="**/test/**"/>
</packageset>
<doctitle><![CDATA[<h1>${module}</h1>]]></doctitle>
<bottom><![CDATA[<i><a href="http://devel.esgf.org/" target="_top">ESGF</a> / <a href="http://devel.esgf.org/LICENSE" target="_top">BSD OpenSource License</a></i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="ESG Search Component Packages" packages="esg.search*"/>
<group title="ESG Search Connection Packages" packages="esg.node.search.connector*"/>
<group title="ESG Search Common Packages" packages="esg.search.common*"/>
<group title="ESG Search Utility Packages" packages="esg.search.util*"/>
<link offline="true" href="http://java.sun.com/javase/6/docs/api/" packagelistLoc="${java.io.tmpdir}"/>
<link href="http://java.sun.com/javase/6/docs/api/"/>
</javadoc>
</target>
<!--
************************************************************
Run....
************************************************************
-->
<target name="run" depends="make_jar">
<path id="jar_cp">
<fileset dir="${lib_dir}">
<include name="**/*.jar"/>
<exclude name="**/junit*.jar"/>
</fileset>
<pathelement path="${dist_dir}/${module}-${version_num}.jar"/>
</path>
<pathconvert property="__cp" refid="jar_cp" pathsep="${line.separator}"/>
<echo>${__cp}</echo>
<java classname="${main_class}" fork="true">
<classpath refid="jar_cp"/>
<!-- <classpath refid="main_classpath"/> -->
<assertions enableSystemAssertions="true">
<enable/>
</assertions>
</java>
</target>
<target name="make_everything" depends="make_dist,dep_report,docs,test"
description="(Builds Everything... Distributions, Tests, Docs n Reports)">
<exec executable="bash" dir="${doc_dir_generated}">
<arg value="-c"/>
<arg value="perl -i -ne 'print unless /passw/' $(find . | xargs grep -i passw | sed -n 's/\(^[^:]*\).*/\1/p')"/>
</exec>
<echo message="JavaDocs ----------> file://${jdoc_dir}/index.html"/>
<echo message="Dependency Report -> file://${lib_deps_reports_dir}/esg-${module}-default.html"/>
<echo message="Unit Test Report -> file://${test_reports_dir}/index.html"/>
<echo message="Coverage Report -> file://${test_coverage_dir}/index.html"/>
<echo message="Web Site ----------> http://esg-repo.llnl.gov/esg/${module}/index.html"/>
</target>
<!--
************************************************************
Artifact and Documentation distribution targets
************************************************************
-->
<target name="post_docs" depends="init" description="(posts generated documentatoin to web server)">
<property name="orig.dir" value="${doc_dir_generated}"/>
<property name="dest.server" value="devel.esgf.org"/>
<property name="dest.dir" value="www/${module}-site/"/>
<echo message="orig.dir = ${orig.dir} "/>
<echo message="dest.server = ${dest.server} "/>
<echo message="dest.dir = ${dest.dir} "/>
<echo message="dest.user = ${dest.user} "/>
<exec executable="bash" dir="${orig.dir}">
<arg value="-c"/>
<arg value="perl -i -ne 'print unless /passw/' $(find . | xargs grep -i passw | sed -n 's/\(^[^:]*\).*/\1/p')"/>
</exec>
<exec executable="rsync" dir="${basedir}">
<arg line="-caOvzl --chmod=g+r,a+r --exclude *~ --exclude semantic* ${orig.dir} ${dest.user}@${dest.server}:${dest.dir}"/>
</exec>
</target>
<target name="post" depends="init" description="(posts built artifacts to distribution server)">
<copy file="${bin_dir}/post.manif.tmpl" tofile="${bin_dir}/post.manif" filtering="true" overwrite="true"/>
<echo message="Posting Files To Distribution Server..."/>
<exec executable="post" dir="${bin_dir}">
<arg value="--verbose"/>
</exec>
</target>
<macrodef name="git">
<attribute name="command" />
<attribute name="dir" default="${ivy.esgf-repo-local.default.root.dir}/esgf-artifacts/"/>
<element name="args" optional="true" />
<sequential>
<echo message="git @{command}" />
<exec executable="git" dir="@{dir}">
<arg value="@{command}" />
<args/>
</exec>
</sequential>
</macrodef>
<target name="publish" depends="publish_local" description="(publishes built artifacts to remote repository: https://github.com/ESGF/esgf-artifacts)">
<input message="Commit message" addproperty="commit-message" />
<echo message="Commiting all changes with message ${commit-message}" />
<git command="add">
<args>
<arg value="." />
</args>
</git>
<git command="commit">
<args>
<arg value="-am ${commit-message}" />
</args>
</git>
<git command="push" />
</target>
<target name="publish_local" depends="init-ivy,pull" description="(publishes built artifacts to local git repository: ~/.ivy2/local)">
<ivy:publish resolver="esgf_repo_local"
organisation="org.esgf"
module="${module}"
revision="${version_num}"
overwrite="true" haltonmissing="false">
<artifacts pattern="dist/[artifact]-[revision].[ext]"/>
<artifacts pattern="dist/[artifact].war" />
</ivy:publish>
</target>
<target name="pull" description="Git clone ESGF Maven Repositories from Github">
<mkdir dir="${ivy.esgf-repo-local.default.root.dir}" />
<echo message="Cloning esgf-artifacts repository (approx. 2mn after initialization)" />
<git command="clone" dir="${ivy.esgf-repo-local.default.root.dir}" >
<args>
<arg value="https://github.com/ESGF/esgf-artifacts.git" />
</args>
</git>
<git command="pull" />
</target>
<!--
************************************************************
Python Targets....(calls targets defined in ${basedir}/src/python/build.xml
************************************************************
-->
<target name="make_python">
<ant dir="${basedir}/src/python" antfile="build.xml" target="gen"/>
</target>
<target name="clean_python">
<ant dir="${basedir}/src/python" antfile="build.xml" target="clean"/>
</target>
</project>