Project

General

Profile

metacat / build.xml @ 6801

1
<?xml version="1.0"?>
2
<!--
3
        *   '$RCSfile$'
4
        *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
        *   Copyright: 2000 Regents of the University of California and the
6
        *              National Center for Ecological Analysis and Synthesis
7
        * For Details: http://www.nceas.ucsb.edu/
8
        *
9
        *    '$Author: tao $'
10
        *    '$Date: 2011-12-16 11:37:36 -0800 (Fri, 16 Dec 2011) $'
11
        *    '$Revision: 6801 $'
12
        *
13
        * Build file for the Ant cross-platform build system for metacat
14
        * See http://jakarta.apache.org for details on Ant
15
        *
16
        * usage: ant [compile|jar|install|jdoc]
17
        *
18
        * This program is free software; you can redistribute it and/or modify
19
        * it under the terms of the GNU General Public License as published by
20
        * the Free Software Foundation; either version 2 of the License, or
21
        * (at your option) any later version.
22
        *
23
        * This program is distributed in the hope that it will be useful,
24
        * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
        * GNU General Public License for more details.
27
        *
28
        * You should have received a copy of the GNU General Public License
29
        * along with this program; if not, write to the Free Software
30
        * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
        <property environment="env" />
35
        <property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

    
38
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43

    
44
        <!-- defining the axis tasks -->
45
        <path id="axis.ant.classpath">
46
                <fileset dir="lib/lsid_lib">
47
                        <include name="*.jar" />
48
                </fileset>
49
        </path>
50
            
51
        <taskdef resource="axis-tasks.properties"
52
                classpathref="axis.ant.classpath" />
53
        
54
        <!-- Determine if ecogrid should be installed-->
55
        <condition property="enable.ecogrid">
56
                <equals arg1="${install.ecogrid}" arg2="true" />
57
        </condition>
58

    
59
        <!-- Determine if perl should be built-->
60
        <condition property="build.perl">
61
                <equals arg1="${make.perl.code}" arg2="true" />
62
        </condition>
63

    
64
        <available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
65
                        property="tomcat.common.exists" />
66

    
67
        <target name="config" depends="setTomcatCommon, setTomcatNoCommon">
68
                <!-- usr for client testing, generally you don't need change-->
69
                <property name="mcuser"
70
                        value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
71
                <property name="mcpassword" value="kepler" />
72
                <property name="mcanotheruser"
73
                        value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
74
                <property name="mcanotherpassword" value="yourpass" />
75
                <property name="piscouser"
76
                        value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
77
                <property name="piscopassword" value="yourpass" />
78
                <property name="lteruser"
79
                        value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
80
                <property name="lterpassword" value="yourpass" />
81

    
82
                <property name="debug" value="on" />
83
                <property name="morphosourcedir" value="../morpho" />
84
                <property name="utilitiesdir" value="../utilities" />
85
                <property name="installdir"
86
                        value="${app.deploy.dir}/${metacat.context}" />
87

    
88
                <echo>*********** set jsdk to ${jsdk}</echo>
89
        </target>
90
        
91
        <target name="setTomcatCommon" if="tomcat.common.exists" >
92
                <property name="jsdk"
93
                        value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
94
        </target>
95
        
96
        <target name="setTomcatNoCommon" unless="tomcat.common.exists" >
97
                <property name="jsdk"
98
                        value="${build.tomcat.dir}/lib/servlet-api.jar" />
99
        </target>
100
        
101
        <target name="init" depends="config">
102
                <path id="compile.classpath">
103
                        <pathelement location="${jsdk}" />
104
                        <pathelement location="lib" />
105
                        <fileset dir="lib">
106
                                <include name="*.jar" />
107
                        </fileset>
108
                        <fileset dir="lib">
109
                                <include name="xalan.jar" />
110
                        </fileset>
111
                        <fileset dir="lib/lsid_lib">
112
                                <include name="*.jar" />
113
                        </fileset>
114

    
115
                        <!-- Include geoserver, geotools, et. al. -->
116
                        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
117
                                <include name="*.jar" />
118
                        </fileset>
119

    
120
                        <!-- Include OAI-PMH -->
121
                        <fileset dir="lib/oaipmh">
122
                                <include name="*.jar" />
123
                        </fileset>
124

    
125
                </path>
126
                
127
                <path id="test.classpath">
128
                        <pathelement location="${jsdk}" />
129
                        <pathelement location="lib" />
130
                        <fileset dir="lib">
131
                                <include name="*.jar" />
132
                                <exclude name="maven-ant-tasks-2.1.0.jar" />
133
                        </fileset>
134
                        <fileset dir="lib">
135
                                <include name="xalan.jar" />
136
                        </fileset>
137
                        <fileset dir="lib/lsid_lib">
138
                                <include name="*.jar" />
139
                        </fileset>
140

    
141
                        <!-- Include geoserver, geotools, et. al. -->
142
                        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
143
                                <include name="*.jar" />
144
                        </fileset>
145
                
146

    
147
                        <!-- Include OAI-PMH -->
148
                        <fileset dir="lib/oaipmh">
149
                                <include name="*.jar" />
150
                        </fileset>
151

    
152
                </path>
153

    
154
                <!-- It is less likely you'll need to make any changes from here down,
155
                        but customization is possible -->
156
                <property name="name" value="metacat" />
157
                <property name="Name" value="MetaCat" />
158
                <property name="debugprefix" value="${Name}:" />
159
                <property name="release" value="${metacat.version}" />
160
                <property name="style-common-relpath" value="/style/common" />
161
                <property name="style-shared-relpath" value="/style/shared" />
162
                <property name="schema-relpath" value="/schema" />
163
                <property name="style-common-cvsrelpath"
164
                        value="lib${style-common-relpath}" />
165
                <property name="schema-cvsrelpath" value="lib${schema-relpath}" />
166
                <property name="style-skins-relpath" value="/style/skins" />
167
                <property name="util-module" value="utilities" />
168
                <!-- property name="utilities-tag" value="trunk" / -->
169
                <property name="utilities-tag" value="branches/UTILITIES_1_1_0_RC3" />
170
                <property name="seek-tag" value="tags/ECOGRID_1_2_2_RC5" />
171
                <property name="eml-module" value="eml" />
172
                <property name="eml-version" value="2.0.0beta6" />
173
                <property name="eml-beta-tag"
174
                        value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
175
                <property name="eml2_0_0-schema-tag"
176
                        value="RELEASE_EML_2_0_0_UPDATE_1" />
177
                <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
178
                <property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
179
                <property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1_RC_2" />
180
                <property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0_RC13" />
181
                <property name="eml2_0_0namespace"
182
                        value="eml://ecoinformatics.org/eml-2.0.0" />
183
                <property name="eml2_0_1namespace"
184
                        value="eml://ecoinformatics.org/eml-2.0.1" />
185
                <property name="eml2_1_0namespace"
186
                        value="eml://ecoinformatics.org/eml-2.1.0" />
187
                <property name="eml2_1_1namespace"
188
                        value="eml://ecoinformatics.org/eml-2.1.1" />
189
                <property name="stmmlnamespace"
190
                        value="http://www.xml-cml.org/schema/stmml" />
191
                <property name="eml-css" value="eml_xsl.css" />
192
                <property name="eml-module.default.css" value="default.css" />
193
                <property name="systemidserver" value="" />
194
                <property name="html-path" value="" />
195
                <property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
196

    
197

    
198
                <!-- Config for registry variables -->
199
                <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
200
                <property name="scope" value="obfs" />
201
                <property name="responseForm" value="genericResponse.tmpl" />
202
                <property name="entryForm" value="entryForm.tmpl" />
203
                <property name="guide" value="genericGuide.tmpl" />
204
                <property name="loginForm" value="loginForm.tmpl" />
205
                <property name="confirmData" value="confirmData.tmpl" />
206
                <property name="deleteData" value="deleteData.tmpl" />
207
                <property name="genericHeader" value="genericHeader.tmpl" />
208
                <property name="genericFooter" value="genericFooter.tmpl" />
209

    
210
                <filter token="scope" value="${scope}" />
211
                <filter token="responseForm" value="${responseForm}" />
212
                <filter token="entryForm" value="${entryForm}" />
213
                <filter token="guide" value="${guide}" />
214
                <filter token="loginForm" value="${loginForm}" />
215
                <filter token="confirmData" value="${confirmData}" />
216
                <filter token="deleteData" value="${deleteData}" />
217
                <filter token="genericHeader" value="${genericHeader}" />
218
                <filter token="genericFooter" value="${genericFooter}" />
219
                <filter token="adminname" value="${adminname}" />
220
                <filter token="recipient" value="${recipient}" />
221
                <filter token="metacatVersion" value="${metacat.version}" />
222
                <filter token="metacatRC" value="${metacat.releaseCandidate}" />
223
                <filter token="build.context" value="${metacat.context}" />
224

    
225
                <filter token="docrooturl" value="./" />
226
                <filter token="mcuser" value="${mcuser}" />
227
                <filter token="mcpassword" value="${mcpassword}" />
228
                <filter token="mcanotheruser" value="${mcanotheruser}" />
229
                <filter token="mcanotherpassword" value="${mcanotherpassword}" />
230
                <filter token="eml-css" value="${eml-css}" />
231
                <filter token="style-skins-relpath"
232
                        value="${style-skins-relpath}" />
233
                <filter token="style-common-relpath"
234
                        value="${style-common-relpath}" />
235

    
236
                <filter token="eml-version" value="${eml-version}" />
237
                <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
238
                <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
239
                <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
240
                <filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
241
                <filter token="stmmlnamespace" value="${stmmlnamespace}" />
242
                <filter token="debugprefix" value="${debugprefix}" />
243

    
244
                <filter token="defaultStage" value="${defaultStage}" />
245
                <filter token="defaultHeader" value="${defaultHeader}" />
246
                <filter token="defaultFooter" value="${defaultFooter}" />
247
                <filter token="defaultChangePass" value="${defaultChangePass}" />
248
                <filter token="defaultResetPass" value="${defaultResetPass}" />
249
                <filter token="changePassSuccess" value="${changePassSuccess}" />
250
                <filter token="resetPassSuccess" value="${resetPassSuccess}" />
251
                <filter token="registerFailed" value="${registerFailed}" />
252
                <filter token="registerLter" value="${registerLter}" />
253
                <filter token="registerMatch" value="${registerMatch}" />
254
                <filter token="registerSuccess" value="${registerSuccess}" />
255
                <filter token="register" value="${register}" />
256
                <filter token="searchResults" value="${searchResults}" />
257
                <filter token="ldapMainServerFailure"
258
                        value="${ldapMainServerFailure}" />
259
                <filter token="lter-user" value="${lteruser}" />
260
                <filter token="lter-pass" value="${lterpassword}" />
261
                <filter token="pisco-user" value="${piscouser}" />
262
                <filter token="pisco-pass" value="${piscopassword}" />
263

    
264

    
265
                <!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
266
                <!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
267
                <!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
268

    
269
                <property name="srcdir" value="./src" />
270
                <property name="lib.dir" value="./lib" />
271
                <property name="docdir" value="./docs" />
272
                <property name="cgidir" value="./cgi-bin" />
273
                <property name="testdir" value="./test" />
274
                <property name="testtorun" value="QueryGroupTest" />
275
                <property name="junittestsdir"
276
                        value="./test/edu/ucsb/nceas/metacattest" />
277
                <property name="junitnettestsdir"
278
                        value="./test/edu/ucsb/nceas/metacatnettest" />
279
                <property name="build.dir" value="./build" />
280
                <property name="build.src" value="${build.dir}/src" />
281
                <property name="build.dest" value="${build.dir}/classes" />
282
                <property name="build.samples" value="${build.dir}/samples" />
283
                <property name="build.tests" value="${build.dir}/tests" />
284
                <property name="build.tmp" value="${build.dir}/tmp" />
285
                <property name="build.metacattest"
286
                        value="${build.tests}/metacattest" />
287
                <property name="build.metacatnettest"
288
                        value="${build.tests}/metacatnettest" />
289
                <property name="build.data" value="${build.dir}/data" />
290
                <property name="build.javadocs" value="${build.dir}/docs/api" />
291
                <property name="build.war" value="${build.dir}/war" />
292
                <property name="dist.dir" value="dist" />
293
                <property name="ver.dir" value="${dist.dir}/${name}-${release}" />
294
                <property name="ver.src" value="${ver.dir}/src" />
295
                <property name="util.dir" value="${dist.dir}/${util-module}" />
296
                <property name="test.dir" value="${dist.dir}/test" />
297
                <!-- directories for creating a Harvest List Editor distribution -->
298
                <property name="dist.dir.hle" value="disthle" />
299
                <property name="ver.dir.hle"
300
                        value="${dist.dir.hle}/harvest-list-editor-${release}" />
301
                <property name="pkg.dir" value="./package" />
302
                <property name="deb.pkg.dir" value="${pkg.dir}/debian" />
303

    
304
                <property name="ecogrid-target-name" value="metacatImpl" />
305
                <property name="ecogrid-module-dest-dir" value=".." />
306
                <property name="ecogrid-module" value="seek/projects/ecogrid" />
307
                <property name="ecogrid-dist-dir"
308
                        value="${dist.dir}/${ecogrid-module}" />
309
                <property name="ecogrid-dir"
310
                        value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
311

    
312
                <property name="package.home" value="edu/ucsb/nceas/metacat" />
313

    
314
                <!-- set up svn -->
315
                <property name="svnant.lib" value="lib" />
316
                <property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
317
                <property name="svnClientAdapter.jar"
318
                        value="${svnant.lib}/svnClientAdapter.jar" />
319
                <property name="svnjavahl.jar"
320
                        value="${svnant.lib}/svnjavahl.jar" />
321
                <property name="svn.utilitiesUrl"
322
                        value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
323
                <property name="svn.ecogridUrl"
324
                        value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
325
                <property name="svn.emlBetaUrl"
326
                        value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
327
                <property name="svn.eml200SchemaUrl"
328
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
329
                <property name="svn.eml201SchemaUrl"
330
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
331
                <property name="svn.eml210SchemaUrl"
332
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
333
                <property name="svn.eml211SchemaUrl"
334
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
335
                <property name="svn.eml2StyleUrl"
336
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
337

    
338
                <!-- load the svn task -->
339
                <path id="svn.classpath">
340
                        <pathelement location="${svnjavahl.jar}" />
341
                        <pathelement location="${svnant.jar}" />
342
                        <pathelement location="${svnClientAdapter.jar}" />
343
                </path>
344
                <taskdef resource="svntask.properties"
345
                        classpathref="svn.classpath" />
346

    
347
                <condition property="utilities.required">
348
                        <or>
349
                                <not>
350
                                        <available file="lib/utilities.jar" />
351
                                </not>
352
                                <not>
353
                                        <available file="${utilitiesdir}" type="dir" />
354
                                </not>
355
                        </or>
356
                </condition>
357
                <!-- peer.utilities.required is used when there is no utilities 
358
                        directory at ${utilitiesdir} -->
359
                <condition property="peer.utilities.required">
360
                        <or>
361
                                <not>
362
                                        <available file="${utilitiesdir}" type="dir" />
363
                                </not>
364
                        </or>
365
                </condition>
366
                <condition property="eml.required">
367
                        <or>
368
                                <not>
369
                                        <available file="lib/schema/eml-2.0.1/eml.xsd" />
370
                                </not>
371
                                <not>
372
                                        <available file="lib/schema/eml-2.0.0/eml.xsd" />
373
                                </not>
374
                                <not>
375
                                        <available file="lib/schema/eml-2.1.0/eml.xsd" />
376
                                </not>
377
                                <not>
378
                                        <available
379
                                                file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
380
                                </not>
381
                        </or>
382
                </condition>
383

    
384
                <condition property="ecogrid.required">
385
                        <or>
386
                                <not>
387
                                        <available file="${ecogrid-dir}/build.properties" />
388
                                </not>
389
                                <not>
390
                                        <available
391
                                                file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
392
                                </not>
393
                        </or>
394
                </condition>
395

    
396
        </target>
397

    
398
        <target name="prepare" depends="init">
399
                <mkdir dir="${build.dir}" />
400
                <mkdir dir="${build.src}" />
401
                <mkdir dir="${build.dest}" />
402
                <mkdir dir="${build.javadocs}" />
403
                <mkdir dir="${build.tmp}" />
404

    
405
                <copy todir="${build.src}" filtering="yes">
406
                        <fileset dir="${srcdir}">
407
                                <include name="edu/**" />
408
                                <include name="com/**" />
409
                                <include name="org/**" />
410
                                <!-- include name="java/**" / -->
411
                                <include name="**/*.sql" />
412
                                <exclude name="**/CVS*" />
413
                                <exclude name="**/.#*" />
414
                                <exclude name="edu/ucsb/nceas/workflowscheduler/**" />
415
                        </fileset>
416
                </copy>
417
                <available file="lib/style/common/emlb6toeml2" type="dir"
418
                        property="styles.not.needed" />
419
        </target>
420

    
421
        <target name="generateStubs" depends="prepare">
422
                <echo
423
                        message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
424
                <axis-wsdl2java verbose="true" output="${srcdir}"
425
                        url="/tmp/KeplerWebService.wsdl" />
426
        </target>
427

    
428
        <target name="compile" depends="prepare,utilities"
429
                description="Compiles java code to build dir, and copies metacat props files there">
430

    
431
                <javac srcdir="${build.src}" destdir="${build.dest}"
432
                        debug="${debug}"
433
                        excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
434
                        <classpath>
435
                                <path refid="compile.classpath" />
436
                        </classpath>
437
                </javac>
438
        </target>
439

    
440
        <target name="jar" depends="compile,geteml"
441
                description="Compiles and jars metacat java code to metacat.jar in build dir ">
442

    
443
                <delete file="${build.dir}/${name}.jar" />
444
                <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
445
                        excludes="**/protocols/ **/harvesterClient/" />
446
        </target>
447

    
448
        <target name="protocol" depends="compile"
449
                description="Compiles and jars protocol java code to protocol.jar in build dir">
450
                <delete file="${build.dir}/protocol.jar" />
451
                <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
452
                        includes="**/protocols/" />
453
        </target>
454

    
455
        <target name="utilities" depends="config,getpeerutilities"
456
                if="utilities.required">
457
                <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
458
                <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
459
                <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
460
        </target>
461

    
462
        <target name="getpeerutilities" depends="prepare"
463
                if="peer.utilities.required"
464
                description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
465
                <echo message="Exporting utilities files from svn repository:" />
466
                <svn>
467
                        <export srcUrl="${svn.utilitiesUrl}"
468
                                destPath="${utilitiesdir}" />
469
                </svn>
470

    
471
                <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
472
        </target>
473

    
474
        <target name="getutilities" depends="prepare"
475
                description="Checks utility out of svn and copies it to your metacat sandbox">
476
                <svn>
477
                        <export srcUrl="${svn.utilitiesUrl}"
478
                                destPath="${utilitiesdir}" force="true" />
479
                </svn>
480
        </target>
481

    
482
        <target name="client" depends="utilities, prepare"
483
                description="Compiles metacat-client java code to build dir">
484
                <javac srcdir="${build.src}" destdir="${build.dest}"
485
                        includes="edu/ucsb/nceas/metacat/client/*">
486
                        <classpath>
487
                                <path refid="compile.classpath" />
488
                        </classpath>
489
                </javac>
490
        </target>
491

    
492
        <target name="clientjar" depends="client"
493
                description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
494
                <delete file="${build.dir}/${name}-client.jar" />
495
                <jar jarfile="${build.dir}/${name}-client.jar"
496
                        basedir="${build.dest}" includes="**/metacat/client/" />
497
        </target>
498

    
499
        <target name="advancedsearchjar" depends="compile"
500
                description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
501
                <delete file="${build.dir}/advancedsearch.jar" />
502
                <jar jarfile="${build.dir}/advancedsearch.jar"
503
                        basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
504
        </target>
505

    
506
        <target name="harvester" depends="client"
507
                description="Compiles harvester java code to build dir">
508
                <javac srcdir="${build.src}" destdir="${build.dest}"
509
                        includes="edu/ucsb/nceas/metacat/harvesterClient/*">
510
                        <classpath>
511
                                <path refid="compile.classpath" />
512
                        </classpath>
513
                </javac>
514
        </target>
515
                
516
        <target name="harvesterjar" depends="harvester"
517
                description="Compiles and jars harvester java code to harvester.jar in build dir">
518
                <delete file="${build.dir}/harvester.jar" />
519
                <jar jarfile="${build.dir}/harvester.jar"
520
                        basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
521
        </target>
522

    
523
        <target name="harvestListEditorDist" depends="harvesterjar"
524
                description="Prepares a distribution of the Harvest List Editor tool">
525
                <mkdir dir="${dist.dir.hle}" />
526
                <delete dir="${ver.dir.hle}" />
527
                <mkdir dir="${ver.dir.hle}" />
528
                <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
529
                <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
530
                <copy todir="${ver.dir.hle}"
531
                        file="lib/harvester/harvestList.xsd" />
532
                <copy todir="${ver.dir.hle}"
533
                        file="lib/harvester/harvestListEditor.bat" />
534
                <copy todir="${ver.dir.hle}"
535
                        file="lib/harvester/harvestListEditor.sh" />
536
                <delete file="./harvest-list-editor-${release}.zip" />
537
                <zip zipfile="./harvest-list-editor-${release}.zip"
538
                        basedir="${ver.dir.hle}" />
539
                <delete file="./harvest-list-editor-${release}.tar.gz" />
540
                <tar tarfile="./harvest-list-editor-${release}.tar"
541
                        basedir="${ver.dir.hle}" />
542
                <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
543
                        src="./harvest-list-editor-${release}.tar" />
544
                <delete file="./harvest-list-editor-${release}.tar" />
545
        </target>
546

    
547
        <target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
548
                if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
549

    
550
        <target name="getemlpre2" depends="prepare" if="eml.required"
551
                description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
552
                <svn>
553
                        <export srcUrl="${svn.emlBetaUrl}"
554
                                destPath="${build.tmp}/eml_${eml-beta-tag}" />
555
                </svn>
556
                <mkdir dir="lib/dtd" />
557
                <copy todir="lib/dtd" filtering="yes">
558
                        <fileset
559
                                dir="${build.tmp}/eml_${eml-beta-tag}">
560
                                <include name="*.dtd" />
561
                        </fileset>
562
                        <mapper type="glob" from="eml-*.dtd"
563
                                to="eml-*-${eml-version}.dtd" />
564
                </copy>
565

    
566
                <copy todir="${style-common-cvsrelpath}" filtering="yes">
567
                        <fileset
568
                                dir="${build.tmp}/eml_${eml-beta-tag}/style">
569
                                <include name="**/*.xsl" />
570
                        </fileset>
571
                </copy>
572
        </target>
573

    
574
        <target name="geteml2+" depends="prepare" if="eml.required"
575
                description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
576
                <svn>
577
                        <export srcUrl="${svn.eml200SchemaUrl}"
578
                                destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
579
                </svn>
580
                <mkdir dir="lib/schema/eml-2.0.0" />
581
                <copy todir="lib/schema/eml-2.0.0" filtering="yes">
582
                        <fileset
583
                                dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
584
                                <include name="*.xsd" />
585
                        </fileset>
586

    
587
                        <!-- shouldn't we have a mapper here like this??
588
                                <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
589
                                
590
                                Jing's code didn't nave one - does it need to be added?
591
                                NOTE that eml-version is set to beta 6, so this would need changing -->
592

    
593
                </copy>
594
                <!-- <antcall target="copyxsl">
595
                        <param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
596
                        <param name="dirname" value="eml-2.0.0" />
597
                        </antcall> -->
598

    
599
                <!-- Checkout eml201 for given schema tag-->
600
                <svn>
601
                        <export srcUrl="${svn.eml201SchemaUrl}"
602
                                destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
603
                </svn>
604
                <mkdir dir="lib/schema/eml-2.0.1" />
605
                <copy todir="lib/schema/eml-2.0.1" filtering="yes">
606
                        <fileset
607
                                dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
608
                                <include name="*.xsd" />
609
                        </fileset>
610
                </copy>
611

    
612
                <!-- Checkout eml201 again for given style sheet tag-->
613
                <!-- echo>Enter CVS password: </echo>
614
                        <cvs cvsRoot="${cvsroot}"
615
                        package="${eml-module}"
616
                        tag="${eml2_0_1-style-tag}"
617
                        dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
618
                        <antcall target="copyxsl">
619
                        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
620
                        <param name="dirname" value="eml-2.0.1" />
621
                        </antcall -->
622

    
623
                <!-- Checkout eml210 for given schema tag-->
624
                <svn>
625
                        <export srcUrl="${svn.eml210SchemaUrl}"
626
                                destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
627
                </svn>
628
                <mkdir dir="lib/schema/eml-2.1.0" />
629
                <copy todir="lib/schema/eml-2.1.0" filtering="yes">
630
                        <fileset
631
                                dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
632
                                <include name="*.xsd" />
633
                        </fileset>
634
                </copy>
635

    
636
                <!-- Checkout eml210 for given style sheet tag-->
637
                <svn>
638
                        <export srcUrl="${svn.eml2StyleUrl}"
639
                                destPath="${build.tmp}/eml_${eml2-style-tag}" />
640
                </svn>
641
                <antcall target="copyxsl">
642
                        <param name="cvs.tagname" value="${eml2-style-tag}" />
643
                        <!-- param name="dirname" value="eml-2.1.0" / -->
644
                        <param name="dirname" value="eml-2" />
645
                </antcall>
646
                
647
                <!-- Checkout eml210 for given schema tag-->
648
                <svn>
649
                        <export srcUrl="${svn.eml211SchemaUrl}"
650
                                destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
651
                </svn>
652
                <mkdir dir="lib/schema/eml-2.1.1" />
653
                <copy todir="lib/schema/eml-2.1.1" filtering="yes">
654
                        <fileset
655
                                dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
656
                                <include name="*.xsd" />
657
                        </fileset>
658
                </copy>
659
        </target>
660

    
661
        <target name="copyxsl"
662
                description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
663

    
664
                <delete file="${style-common-cvsrelpath}/${eml-css}" />
665

    
666
                <copy todir="${style-common-cvsrelpath}/${dirname}"
667
                        filtering="yes">
668
                        <fileset
669
                                dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
670
                                <include name="**/*.xsl" />
671
                        </fileset>
672
                </copy>
673

    
674

    
675
                <!-- now copy default css from eml module and put it in style-common-path
676
                        dir with a new name, so other skin-specific css can import it if reqd -->
677
                <copy
678
                        file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
679
                        tofile="${style-common-cvsrelpath}/${eml-css}" />
680

    
681
        </target>
682

    
683
        <target name="correctEML201Docs" depends="jar"
684
                description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
685
                <copy todir="${build.dir}" file="lib/metacat.properties"
686
                        filtering="yes" />
687
                <java
688
                        classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
689
                        <classpath>
690
                                <path refid="compile.classpath" />
691
                                <fileset dir="${build.dir}">
692
                                        <include name="${name}.jar" />
693
                                </fileset>
694
                        </classpath>
695
                </java>
696
        </target>
697

    
698
        <target name="install-spatial" depends="jar,clientjar,harvesterjar"
699
                description="Installs spatial option for metacat">
700

    
701
                <property name="spatial.dir" value="./lib/spatial" />
702
                <property name="spatial.geoserver.dir"
703
                        value="${spatial.dir}/geoserver" />
704
                <property name="spatial.webinf-mods"
705
                        value="${spatial.dir}/WEB-INF" />
706

    
707
                <!-- Copy geoserver libs into ${war.lib} -->
708
                <copy todir="${war.lib}" filtering="no">
709
                        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
710
                                <include name="**" />
711
                        </fileset>
712
                </copy>
713
                
714
                <copy todir="${dist.dir}">
715
                        <fileset dir="./lib/spatial/geoserver" includes="*.war" />
716
                </copy>
717

    
718
        </target>
719

    
720
        <target name="install" depends="build-metacat"
721
                description="* Full Install For Development *">
722
                <copy file="${dist.dir}/${metacat.context}.war"
723
                        todir="${app.deploy.dir}" />
724
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
725
                        todir="${app.deploy.dir2}" />-->
726
                <delete dir="${app.deploy.dir}/${metacat.context}" />
727
                <!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
728
                <copy file="${dist.dir}/geoserver.war"
729
                                        todir="${app.deploy.dir}" />
730
                <tstamp>
731
                        <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
732
                </tstamp>
733
                <echo>Dev install completed at ${NOW}</echo>
734
        </target>
735

    
736
        <target name="build-metacat" depends="install-ecogrid, install-spatial"
737
                description="Build Metacat">
738
        </target>
739

    
740
        <target name="install-ecogrid" depends="warPrepare, get-ecogrid"
741
                if="enable.ecogrid" description="Install Ecogrid Compentent">
742
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
743
                        inheritall="false">
744
                        <property name="context" value="${metacat.context}" />
745
                        <property name="target" value="${ecogrid-target-name}" />
746
                </ant>
747
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
748
                        inheritall="false">
749
                        <property name="context" value="${metacat.context}" />
750
                        <property name="target" value="${ecogrid-target-name}" />
751
                        <property name="metacat.dir" value="${basedir}"/>
752
                </ant>
753
                <!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
754
                        <webinf dir="${ecogrid-dir}/lib">
755
                        <include name="server-config.wsdd"/>
756
                        </webinf>
757
                        </war -->
758
                <copy file="${ecogrid-dir}/build/${metacat.context}.war"
759
                        todir="${dist.dir}" overwrite="true" />
760

    
761

    
762
        </target>
763

    
764
        <target name="get-ecogrid" depends="init"
765
                description="Check out ecogrid module" if="ecogrid.required">
766
                <svn>
767
                        <export srcUrl="${svn.ecogridUrl}" force="true"
768
                                destPath="${ecogrid-dir}" />
769
                </svn>
770
        </target>
771

    
772
        <!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
773
                <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
774
                <property name="context" value="${metacat.context}"/>
775
                <property name="target" value="${ecogrid-target-name}"/>
776
                <property name="metacat.dir" value="."/>
777
                <property name="hostname" value="${ecogrid.hostname}"/>
778
                <property name="port" value="${config.port}"/>
779
                </ant>
780
                </target -->
781

    
782
        <target name="clean-ecogrid-server-config-wsdd" depends="init"
783
                description="Automately generate wsdd for ecogrid service">
784
                <delete
785
                        file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
786
        </target>
787

    
788
        <target name="install-skin" depends="init"
789
                description="Install a Skin">
790

    
791
                <input message="Please enter name of the skin"
792
                        addproperty="skin-name" />
793

    
794
                <mkdir dir="${installdir}/style/skins/${skin-name}" />
795
                <copy todir="${installdir}/style/skins/${skin-name}"
796
                        filtering="yes">
797
                        <fileset dir="lib/style/skins/${skin-name}">
798
                                <exclude name="**/*.png" />
799
                                <exclude name="**/*.gif" />
800
                                <exclude name="**/*.jpg" />
801
                                <exclude name="**/CVS*" />
802
                                <exclude name="**/.#*" />
803
                        </fileset>
804
                </copy>
805
                <copy todir="${installdir}/style/skins/${skin-name}"
806
                        filtering="no">
807
                        <fileset dir="lib/style/skins/${skin-name}">
808
                                <include name="**/*.png" />
809
                                <include name="**/*.gif" />
810
                                <include name="**/*.jpg" />
811
                                <exclude name="**/CVS*" />
812
                                <exclude name="**/.#*" />
813
                        </fileset>
814
                </copy>
815
                <copy todir="${installdir}/style/common" filtering="yes">
816
                        <fileset dir="lib/style/common">
817
                                <include name="*.js" />
818
                                <include name="*.jsp" />
819
                                <include name="*.css" />
820
                                <exclude name="*.png" />
821
                                <exclude name="*.gif" />
822
                                <exclude name="*.jpg" />
823
                                <exclude name="**/CVS*" />
824
                                <exclude name="**/.#*" />
825
                        </fileset>
826
                </copy>
827
                <!--
828
                        <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
829
                        <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
830
                        <fileset dir="lib/style/skins/${skin-name}/images">
831
                        <include name="*.png"/>
832
                        <include name="*.gif"/>
833
                        <include name="*.jpg"/>
834
                        </fileset>
835
                        </copy>
836
                -->
837

    
838
                <echo message="Install Skin completed." />
839
        </target>
840

    
841
        <target name="war" depends="warPrepare,install-spatial"
842
                description="Create a web archive (WAR) for servlet deployment">
843
                <mkdir dir="${dist.dir}" />
844
                <war destfile="${dist.dir}/${metacat.context}.war"
845
                        webxml="${build.war}/web.xml">
846
                        <fileset dir="${war.context}" />
847
                        <lib dir="${war.lib}" />
848
                        <webinf dir="${war.webinf}" />
849
                </war>
850
        </target>
851

    
852
        <target name="warPrepare"
853
                depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
854
                description="Prepare files for creating a web archive (WAR)">
855

    
856
                <property name="war.lib" value="${build.war}/lib" />
857
                <property name="war.webinf" value="${build.war}/WEB-INF" />
858
                <property name="war.context"
859
                        value="${build.war}/${metacat.context}" />
860
                <property name="war.webinf.sql" value="${war.webinf}/sql" />
861
                <property name="war.webinf.scripts"
862
                        value="${war.webinf}/scripts" />
863
                <property name="war.context.cgi" value="${war.context}/cgi-bin" />
864
                <property name="war.context.docs" value="${war.context}/docs" />
865
                <property name="war.context.temp" value="${war.context}/temp" />
866
                <property name="war.context.templates"
867
                        value="${war.context}${style-common-relpath}/templates" />
868
                <mkdir dir="${war.lib}" />
869
                <mkdir dir="${war.webinf}" />
870
                <mkdir dir="${war.context}" />
871
                <mkdir dir="${war.webinf.sql}" />
872
                <mkdir dir="${war.context.cgi}" />
873
                <mkdir dir="${war.context.docs}" />
874
                <mkdir dir="${war.context.temp}" />
875
                <mkdir dir="${war.context.templates}" />
876

    
877
                <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
878
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
879
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
880
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
881
                <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
882
                <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
883
                <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
884
                <copy todir="${war.lib}" filtering="no">
885
                        <fileset dir="lib">
886
                                <!--
887
                                        <not>
888
                                        <filename name="${jdbc-jar-name}"/>
889
                                        </not>
890
                                -->
891
                                <include name="*.jar" />
892
                                <exclude name="maven-ant-tasks*.jar" />
893
                        </fileset>
894
                        <fileset dir="lib">
895
                                <include name="xalan.jar" />
896
                                <include name="gwt*.jar" />
897
                        </fileset>
898
                        <fileset dir="lib/oaipmh">
899
                                <include name="oaicat.jar" />
900
                        </fileset>
901
                </copy>
902
                <!-- MCD copy file="lib/web.xml.${tomcatversion}"
903
                        tofile="${build.war}/web.xml" / -->
904
                <!-- MCD added next - Remove the tomcat5 reference-->
905
                <copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
906
                <copy file="lib/metacat.properties" todir="${war.webinf}"
907
                        filtering="yes" />
908
                <copy file="lib/metacat.properties.metadata.xml"
909
                        todir="${war.webinf}" filtering="no" />
910
                <copy file="lib/org.properties.metadata.xml"
911
                        todir="${war.webinf}" filtering="no" />
912
                <copy file="lib/auth.properties.metadata.xml"
913
                        todir="${war.webinf}" filtering="no" />
914
                <copy todir="${war.webinf}" filtering="yes">
915
                        <fileset dir="lib">
916
                                <include name="skin.configs/**" />
917
                        </fileset>
918
                </copy>
919
                <copy file="lib/log4j.properties" todir="${war.webinf}"
920
                        filtering="yes" />
921
                <copy file="lib/hazelcast.xml" todir="${war.webinf}"
922
                        filtering="yes" />
923
                <copy todir="${war.context}" filtering="no">
924
                        <fileset dir="lib">
925
                                <include name="**/*.jpg" />
926
                                <include name="**/*.png" />
927
                                <include name="**/*.gif" />
928
                                <include name="LiveMap_30/**" />
929
                                <include name="oaipmh/**" />
930
                        </fileset>
931
                </copy>
932
                <copy todir="${war.context}" filtering="yes">
933
                        <fileset dir="lib">
934
                                <exclude name="*.jar" />
935
                                <exclude name="*.properties" />
936
                                <exclude name="*.metadata.xml" />
937
                                <exclude name="web.xml" />
938
                                <exclude name="**/*.jpg" />
939
                                <exclude name="**/*.png" />
940
                                <exclude name="**/*.gif" />
941
                                <exclude name="lsid_lib/**" />
942
                                <exclude name="lsid_conf/**" />
943
                                <exclude name="LiveMap_30/**" />
944
                                <exclude name="oaipmh/**" />
945
                                <exclude name="skin.configs/**" />
946
                                <exclude name="spatial/geoserver/**" />
947
                        </fileset>
948
                </copy>
949
                <copy todir="${war.context}" filtering="no">
950
                        <fileset dir="lib">
951
                                <include name="spatial/geoserver/data/**" />
952
                        </fileset>
953
                </copy>
954
                <copy todir="${war.context.docs}" filtering="yes">
955
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
956
                </copy>
957
                <copy todir="${war.context.docs}" filtering="no">
958
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
959
                </copy>
960
                <copy todir="${war.webinf.sql}" filtering="yes">
961
                        <fileset dir="src">
962
                                <include name="**/*.sql" />
963
                        </fileset>
964
                </copy>
965
                <copy todir="${war.webinf.scripts}" filtering="yes">
966
                        <fileset dir="src/scripts" />
967
                </copy>
968
                <copy todir="${war.webinf.scripts}"
969
                        file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
970
                        failonerror="false" />
971

    
972
                <copy file="src/perl/register-dataset.cgi"
973
                        todir="${war.context.cgi}" />
974
                <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
975
                <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
976

    
977
                <!-- registry cgi section -->
978
                <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
979
                        used in readDocumentFromMetacat -->
980
                <!-- TODO MCD copy temp files to actual location using config util?? -->
981
                <copy todir="${war.context.temp}" filtering="yes">
982
                        <fileset dir="lib/style/common/emlb6toeml2">
983
                                <include name="*.xsl" />
984
                                <include name="*.xml" />
985
                        </fileset>
986
                </copy>
987
                <available file="lib/style/common/emlb6toeml2" type="dir"
988
                        property="styles.not.needed" />
989

    
990
                <!-- ldap cgi section -->
991
                <copy todir="${war.context.templates}">
992
                        <fileset dir="lib/style/common/templates">
993
                                <!-- SCW: Copy all files -->
994
                        </fileset>
995
                </copy>
996
        </target>
997

    
998
        <target name="cgiPrepare" if="build.perl">
999
                <exec dir="src/perl/Metacat/" executable="make">
1000
                        <arg value="clean" />
1001
                </exec>
1002
                <exec dir="src/perl/Metacat/" executable="perl">
1003
                        <arg value="Makefile.PL" />
1004
                </exec>
1005
                <exec dir="src/perl/Metacat/" executable="make" />
1006
        </target>
1007

    
1008
        <target name="testPrepare"
1009
                description="Copies test files into the war directories">
1010
                <echo>in testPrepare</echo>
1011
                <property name="war.context.test"
1012
                        value="${build.war}/${metacat.context}/test" />
1013
                <mkdir dir="${war.context.test}" />
1014
                <copy todir="${war.context.test}" filtering="yes">
1015
                        <fileset dir="test/servertestfiles">
1016
                                <include name="*/**" />
1017
                        </fileset>
1018
                </copy>
1019
        </target>
1020

    
1021
        <target name="getConversionXSL" depends="prepare"
1022
                unless="styles.not.needed"
1023
                description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1024

    
1025
                <svn>
1026
                        <export srcUrl="${svn.eml2StyleUrl}"
1027
                                destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1028
                </svn>
1029

    
1030
                <mkdir dir="lib/style/common/emlb6toeml2" />
1031
                <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1032
                        <fileset
1033
                                dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1034
                                <include name="*.xsl" />
1035
                                <include name="*.xml" />
1036
                        </fileset>
1037
                </copy>
1038
        </target>
1039

    
1040
        <target name="testprep" depends="jar,clientjar,harvesterjar">
1041
                <mkdir dir="${build.tests}" />
1042
                <copy todir="${build.tests}" encoding="UTF-8">
1043
                        <fileset dir="${testdir}">
1044
                                <include name="edu/**" />
1045
                        </fileset>
1046
                </copy>
1047
                <copy todir="${build.tests}" file="${testdir}/test.properties" />
1048

    
1049
                <path id="test.classpath">
1050
                        <path refid="compile.classpath" />
1051
                        <fileset dir="${build.dir}">
1052
                                <include name="${name}.jar" />
1053
                                <include name="${name}-client.jar" />
1054
                                <include name="harvester.jar" />
1055
                        </fileset>
1056
                </path>
1057
                
1058
                <pathconvert pathsep="${line.separator}|  |--" 
1059
                             property="echo.test.classpath"
1060
                             refid="test.classpath">
1061
                </pathconvert>
1062
                <echo message="|--test classpath" />
1063
                <echo message="|  |" />
1064
                <echo message="|  |-- ${echo.test.classpath}" />
1065
                
1066
                <!-- copy and compile the tests into a jar file -->
1067
                <javac srcdir="${build.tests}" destdir="${build.tests}"
1068
                        debug="on" includes="**/*.java" encoding="UTF-8">
1069
                        <classpath refid="test.classpath" />
1070
                </javac>
1071

    
1072
                <jar jarfile="${build.dir}/${name}-junittests.jar"
1073
                        basedir="${build.tests}" >
1074
                        <include name="**/*.class"/>
1075
                        <include name="**/*.xml"/>
1076
                </jar>        
1077
                
1078
        </target>
1079

    
1080
        <target name="test" depends="testprep"
1081
                description="Uses the ant junit task to run all JUnit tests">
1082

    
1083
                <!-- use the ant "junit" task to run JUnit tests. -->
1084
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1085
                        haltonerror="no">
1086
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1087
                        <classpath>
1088
                                <path refid="test.classpath" />
1089
                                <fileset dir="${build.dir}">
1090
                                        <include name="${name}.jar" />
1091
                                        <include name="${name}-client.jar" />
1092
                                        <include name="harvester.jar" />
1093
                                        <include name="${name}-junittests.jar" />
1094
                                </fileset>
1095
                        </classpath>
1096

    
1097
                        <formatter type="plain" />
1098

    
1099
                        <batchtest fork="yes" todir="${build.dir}">
1100
                                <fileset dir="${build.tests}">
1101
                                        <include name="**/*.class" />
1102
                                        <exclude name="**/MCTestCase.class" />
1103
                                        <exclude name="**/ClientViewHelperTest.class" />
1104
                                        <!-- these are not test cases -->
1105
                                        <exclude name="**/MockCNode.class" />
1106
                                        <exclude name="**/D1NodeServiceTest.class" />
1107
                                </fileset>
1108
                        </batchtest>
1109
                </junit>
1110
        </target>
1111

    
1112
        <target name="runonetest" depends="testprep"
1113
                description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1114

    
1115
                <echo>testtorun: ${testtorun}</echo>
1116

    
1117
                <!-- use the ant "junit" task to run JUnit tests. -->
1118
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1119
                        haltonerror="no" showoutput="yes">
1120
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1121
                        <classpath>
1122
                                <path refid="test.classpath" />
1123
                                <fileset dir="${build.dir}">
1124
                                        <include name="${name}.jar" />
1125
                                        <include name="${name}-client.jar" />
1126
                                        <include name="harvester.jar" />
1127
                                        <include name="${name}-junittests.jar" />
1128
                                </fileset>
1129
                        </classpath>
1130

    
1131
                        <formatter type="plain" />
1132

    
1133
                        <batchtest fork="yes" todir="${build.dir}">
1134
                                <fileset dir="${build.tests}">
1135
                                        <include name="**/${testtorun}.class" />
1136
                                </fileset>
1137
                        </batchtest>
1138
                </junit>
1139
        </target>
1140

    
1141
        <target name="testharvester" depends="testprep"
1142
                description="Uses the ant junit task to test only the Harvester code">
1143
                <junit printsummary="yes" haltonfailure="off" fork="yes"
1144
                        haltonerror="off">
1145
                        <classpath>
1146
                                <path refid="compile.classpath" />
1147
                                <fileset dir="${build.dir}">
1148
                                        <include name="${name}.jar" />
1149
                                        <include name="${name}-client.jar" />
1150
                                        <include name="harvester.jar" />
1151
                                        <include name="${name}-junittests.jar" />
1152
                                </fileset>
1153
                        </classpath>
1154
                        <formatter type="plain" />
1155
                        <batchtest fork="yes" todir="${build.dir}">
1156
                                <fileset dir="${build.tests}">
1157
                                        <include name="**/harvesterClient/*.class" />
1158
                                </fileset>
1159
                        </batchtest>
1160
                </junit>
1161
        </target>
1162

    
1163
        <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1164
        <target name="nettest" depends="install"
1165
                description="compiles and runs the metacatnettest code">
1166

    
1167
                <echo>
1168
                        *********************************** Please run ant
1169
                        gethttpclient first! ***********************************
1170
                </echo>
1171
                <!-- copy and compile the tests into a jar file -->
1172
                <mkdir dir="${build.metacatnettest}" />
1173
                <javac srcdir="${junitnettestsdir}"
1174
                        destdir="${build.metacatnettest}" includes="**/*.java">
1175
                        <classpath>
1176
                                <path refid="compile.classpath" />
1177
                                <fileset dir="${build.dir}">
1178
                                        <include name="${name}.jar" />
1179
                                </fileset>
1180
                        </classpath>
1181
                </javac>
1182

    
1183
                <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1184
                        basedir="${build.metacatnettest}" includes="**/*.class" />
1185

    
1186
                <!-- use the ant "junit" task to run JUnit tests. -->
1187
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1188
                        haltonerror="no">
1189
                        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1190
                        <classpath>
1191
                                <path refid="compile.classpath" />
1192
                                <fileset dir="${build.dir}">
1193
                                        <include name="${name}.jar" />
1194
                                        <include name="${name}-junitnettests.jar" />
1195
                                </fileset>
1196
                        </classpath>
1197

    
1198
                        <formatter type="plain" />
1199

    
1200
                        <batchtest fork="yes" todir="${build.dir}">
1201
                                <fileset dir="${build.metacatnettest}">
1202
                                        <include name="**/*.class" />
1203
                                </fileset>
1204
                        </batchtest>
1205
                </junit>
1206
        </target>
1207

    
1208
        <target name="cleanweb" depends="clean"
1209
                description="deletes tomcat web context dir and all its contents">
1210
                <delete dir="${installdir}" />
1211
        </target>
1212

    
1213

    
1214
        <target name="clean" depends="init"
1215
                description="deletes build dir and files that can be regenerated form the release">
1216
                <delete dir="${build.dir}" />
1217
                <delete dir="${dist.dir}" />
1218
        </target>
1219

    
1220
        <target name="localclean" depends="clean"
1221
                description="deletes even jars that depend on external sources such as stylesheets and jars">
1222
                <delete file="lib/utilities.jar" />
1223
        </target>
1224

    
1225
        <target name="fullclean" depends="localclean"
1226
                description="deletes code and eml">
1227
                <delete includeEmptyDirs="true" failonerror="false">
1228
                        <fileset dir="${style-common-cvsrelpath}">
1229
                                <include name="${eml-css}" />
1230
                                <include name="eml-*/*.xsl" />
1231
                                <include name="eml-*" />
1232
                        </fileset>
1233
                        <fileset dir="${schema-cvsrelpath}">
1234
                                <include name="eml-*/*.xsd" />
1235
                        </fileset>
1236
                        <fileset dir="${ecogrid-dir}"/>
1237
                        <fileset dir="lib/style/common/emlb6toeml2"/>
1238
                        <fileset dir="lib/dtd"/>
1239
                        <fileset dir="lib/schema"/>
1240
                        <fileset dir="${utilitiesdir}"/>
1241
                </delete>
1242
        </target>
1243

    
1244
        <target name="jdoc" depends="prepare"
1245
                description="generates javadoc documentation">
1246
                <javadoc packagenames="edu.ucsb.nceas.*"
1247
                        sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1248
                        version="true" use="true" windowtitle="${Name} API"
1249
                        doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1250
                        bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1251
                        <classpath>
1252
                                <path refid="compile.classpath" />
1253
                        </classpath>
1254
                </javadoc>
1255
        </target>
1256

    
1257
        <target name="dist"
1258
                depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1259
                description="prepares a full release distribution">
1260
                <mkdir dir="${dist.dir}" />
1261
                <delete dir="${ver.dir}" />
1262
                <mkdir dir="${ver.dir}" />
1263
                <copy todir="${ver.dir}">
1264
                        <fileset dir="."
1265
                                excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1266
                </copy>
1267
                <copy todir="${ver.dir}" file="build.xml" />
1268
                <copy todir="${ver.dir}" file="build.properties" />
1269

    
1270
                <copy todir="${ver.dir}/docs" filtering="yes">
1271
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1272
                </copy>
1273
                <copy todir="${ver.dir}/docs" filtering="no">
1274
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1275
                </copy>
1276
                <copy todir="${ver.dir}/docs/dev">
1277
                        <fileset dir="${build.dir}/docs" />
1278
                </copy>
1279
                <copy todir="${ver.dir}/src">
1280
                        <fileset dir="${build.dir}/src" />
1281
                </copy>
1282

    
1283
                <mkdir dir="${ver.dir}/tests/servertestfiles" />
1284
                <copy todir="${ver.dir}/test/servertestfiles">
1285
                        <fileset dir="./test/servertestfiles" />
1286
                </copy>
1287
        </target>
1288

    
1289
        <target name="distbin" depends="build-metacat,war-lsid"
1290
                description="prepares a binary distribution">
1291
                <copy todir="${dist.dir}">
1292
                        <fileset dir="./src/scripts" />
1293
                </copy>
1294
                <delete file="./${name}-bin-${release}.zip" />
1295
                <zip zipfile="./${name}-bin-${release}.zip"
1296
                        basedir="${dist.dir}" excludes="metacat-*/**" />
1297
                <delete file="./${name}-bin-${release}.tar.gz" />
1298
                <tar tarfile="./${name}-bin-${release}.tar"
1299
                        basedir="${dist.dir}" excludes="metacat-*/**" />
1300
                <gzip zipfile="./${name}-bin-${release}.tar.gz"
1301
                        src="./${name}-bin-${release}.tar" />
1302
                <delete file="./${name}-bin-${release}.tar" />
1303
        </target>
1304

    
1305
        <target name="distsrc" depends="dist"
1306
                description="prepares a source distribution">
1307
                <mkdir dir="${ver.src}" />
1308
                <copy todir="${ver.src}">
1309
                        <fileset dir="./src" />
1310
                </copy>
1311
                <mkdir dir="${util.dir}" />
1312
                <copy todir="${util.dir}">
1313
                        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1314
                </copy>
1315

    
1316
                <mkdir dir="${ecogrid-dist-dir}" />
1317
                <copy todir="${ecogrid-dist-dir}">
1318
                        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1319
                </copy>
1320

    
1321
                <delete file="${ver.dir}/lib/utilities.jar" />
1322

    
1323
                <delete file="./${name}-src-${release}.zip" />
1324
                <zip zipfile="./${name}-src-${release}.zip"
1325
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1326
                <delete file="./${name}-src-${release}.tar.gz" />
1327
                <tar tarfile="./${name}-src-${release}.tar"
1328
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1329
                <gzip zipfile="./${name}-src-${release}.tar.gz"
1330
                        src="./${name}-src-${release}.tar" />
1331
                <delete file="./${name}-src-${release}.tar" />
1332
                <!--delete dir="${dist.dir}"/ -->
1333
        </target>
1334

    
1335
        <target name="deb-package" depends="distbin"
1336
                description="create a debian installation package">
1337
                <delete dir="${deb.pkg.dir}" />
1338
                <mkdir dir="${deb.pkg.dir}/DEBIAN" />
1339
                <copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1340
                        <fileset dir="./src/scripts/debian"
1341
                                includes="control postinst" />
1342
                </copy>
1343

    
1344
                <mkdir
1345
                        dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1346
                <copy
1347
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1348
                        filtering="yes">
1349
                        <fileset dir="./src/scripts/debian"
1350
                                excludes="control postinst" />
1351
                </copy>
1352
                <chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1353

    
1354
                <copy file="${dist.dir}/knb.war"
1355
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1356
                <copy file="./metacat-bin-${metacat.version}.tar.gz"
1357
                        tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1358

    
1359
                <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1360
                        failonerror="true">
1361
                        <arg line="--build debian" />
1362
                </exec>
1363

    
1364
                <move file="${pkg.dir}/debian.deb"
1365
                        tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1366
        </target>
1367

    
1368
        <target name="stylesheettest">
1369
                <xslt in="${input}" out="eml.html"
1370
                        style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1371
                        <param name="displaymodule" expression="${displaymodule}" />
1372
                        <param name="docid" expression="${input}" />
1373
                        <param name="entitytype" expression="${entitytype}" />
1374
                        <param name="entityindex" expression="${entityindex}" />
1375
                        <outputproperty name="method" value="html" />
1376
                        <outputproperty name="standalone" value="yes" />
1377
                        <outputproperty name="encoding" value="iso8859_1" />
1378
                        <outputproperty name="indent" value="yes" />
1379
                </xslt>
1380
        </target>
1381

    
1382
        <target name="spatial_option" depends="prepare"
1383
                description=" -- compiles code for the spatial option">
1384

    
1385
                <echo message="Compiling the metatcat shapefile creator" />
1386
                <echo message="using the shapelib at: ${shapelib.dir}" />
1387
                <exec dir="." executable="g++" os="Linux, Unix"
1388
                        failonerror="true">
1389
                        <arg
1390
                                line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1391
                </exec>
1392

    
1393
                <exec dir="." executable="g++" os="Linux, Unix"
1394
                        failonerror="true">
1395
                        <arg
1396
                                line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1397
                </exec>
1398
        </target>
1399

    
1400
        <!-- LSID Authority support -->
1401
        <patternset id="lsid.jars">
1402
                <include name="axis.jar" />
1403
                <include name="commons-discovery-0.2.jar" />
1404
                <include name="jaxrpc.jar" />
1405
                <include name="lsid-client-1.1.1.jar" />
1406
                <include name="lsid-server-1.1.1.jar" />
1407
                <include name="saaj.jar" />
1408
                <include name="wsdl4j-1.5.1.jar" />
1409
                <include name="activation.jar" />
1410
                <include name="castor-0.9.5.jar" />
1411
                <include name="dnsjava-1.3.2.jar" />
1412
                <include name="mail.jar" />
1413
                <include name="commons-logging-1.0.4.jar" />
1414
                <!-- These jars may be needed but seem to not actually be,
1415
                        so leaving them out for now
1416
                        <include name="axis-ant.jar" />
1417
                -->
1418
                <!--<include name="GenCastor.class" />-->
1419
        </patternset>
1420
        <patternset id="lib.jars">
1421
                <include name="log4j-1.2.12.jar" />
1422
                <include name="utilities.jar" />
1423
                <include name="xerces*.jar" />
1424
                <include name="xalan*.jar" />
1425
                <include name="xml-apis.jar" />
1426
        </patternset>
1427

    
1428
        <path id="lsid.classpath">
1429
                <fileset dir="${lsid.lib.dir}">
1430
                        <patternset refid="lsid.jars" />
1431
                </fileset>
1432
                <fileset dir="${lib.dir}">
1433
                        <patternset refid="lib.jars" />
1434
                </fileset>
1435
                <fileset dir="${build.dir}">
1436
                        <include name="metacat-client.jar" />
1437
                        <include name="metacat.jar" />
1438
                </fileset>
1439
        </path>
1440

    
1441
        <filterset id="configFilters">
1442
                <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1443
                        value="${config.hostname}" / -->
1444
                <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1445
                        value="${config.port}" / -->
1446
                <!-- MCD BYE filter token="METADATA_LABELS"
1447
                        value="${config.metadataLabelLsid}" / -->
1448
                <!-- MCD BYE filter token="METACAT_SERVER"
1449
                        value="${config.metacatserver}" / -->
1450
                <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1451
                        value="${config.lsidauthority}" / -->
1452
        </filterset>
1453

    
1454
        <target name="prepare-lsid" depends="prepare,utilities,clientjar"
1455
                description="Configure files prior to compilation">
1456
                <mkdir dir="${lsid.build.dir}" />
1457
                <!-- Copy the properties file into the build -->
1458
                <copy file="${conf.dir}/metacat-lsid.properties"
1459
                        tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1460
                        overwrite="true">
1461
                        <filterset refid="configFilters" />
1462
                </copy>
1463
                <copy file="${conf.dir}/log4j.properties"
1464
                        tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1465
                        overwrite="true">
1466
                        <filterset refid="configFilters" />
1467
                </copy>
1468
                <!-- Copy config files into the build -->
1469
                <copy todir="${lsid.build.dir}/WEB-INF">
1470
                        <fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1471
                </copy>
1472
                <!-- Copy the metadata configuration files into the build -->
1473
                <mkdir
1474
                        dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1475
                <copy
1476
                        todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1477
                        <fileset dir="${conf.dir}" includes="**/*.xml" />
1478
                        <fileset dir="${conf.dir}" includes="**/*.xslt" />
1479
                        <filterset refid="configFilters" />
1480
                </copy>
1481
                <!-- Copy services files into the build -->
1482
                <mkdir dir="${lsid.build.dir}/services" />
1483
                <copy todir="${lsid.build.dir}/services">
1484
                        <fileset dir="${services.dir}" />
1485
                        <filterset refid="configFilters" />
1486
                </copy>
1487
                <!-- Copy axis files into the build -->
1488
                <mkdir dir="${lsid.build.dir}" />
1489
                <copy todir="${lsid.build.dir}">
1490
                        <fileset dir="${conf.dir}/axis" excludes="*.properties" />
1491
                </copy>
1492
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1493
                <copy todir="${lsid.build.dir}/WEB-INF/classes">
1494
                        <fileset dir="${conf.dir}/axis" includes="*.properties" />
1495
                </copy>
1496
        </target>
1497

    
1498
        <target name="compile-lsid" depends="prepare-lsid"
1499
                description="Compile Java sources">
1500
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1501
                <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1502
                        destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1503
                        deprecation="${compile.deprecation}"
1504
                        optimize="${compile.optimize}">
1505
                        <classpath refid="lsid.classpath" />
1506
                </javac>
1507
        </target>
1508

    
1509
        <target name="war-lsid" depends="compile-lsid"
1510
                description="Create a war file for the application">
1511
                <mkdir dir="${dist.dir}" />
1512
                <war destfile="${dist.dir}/${authority.context}.war"
1513
                        webxml="${webinf.dir}/web.xml">
1514
                        <fileset dir="${lsid.build.dir}" />
1515
                        <lib dir="${lsid.lib.dir}">
1516
                                <patternset refid="lsid.jars" />
1517
                        </lib>
1518
                        <lib dir="${lib.dir}">
1519
                                <patternset refid="lib.jars" />
1520
                        </lib>
1521
                        <lib dir="${lib.dir}">
1522
                                <include name="xalan.jar" />
1523
                                <include name="xml-apis.jar" />
1524
                        </lib>
1525
                        <lib dir="${build.dir}">
1526
                                <include name="metacat-client.jar" />
1527
                        </lib>
1528
                </war>
1529
        </target>
1530

    
1531
        <target name="deploy-lsid" depends="war-lsid"
1532
                description="Deploy LSID war to servlet container">
1533
                <delete dir="${app.deploy.dir}/${authority.context}" />
1534
                <delete file="${app.deploy.dir}/${authority.context}.war" />
1535
                <mkdir dir="${app.deploy.dir}" />
1536
                <copy todir="${app.deploy.dir}">
1537
                        <fileset dir="${dist.dir}" />
1538
                </copy>
1539
        </target>
1540
        
1541
        <target name="change-metacat-properties" depends="warPrepare"
1542
        description="Chage some default values of metacat.properties">
1543
       <echo file="${metacat-properties-file}" append="true">
1544
                   configutil.propertiesConfigured=true
1545
                   configutil.authConfigured=true
1546
           configutil.skinsConfigured=true
1547
                   configutil.databaseConfigured=true
1548
                   configutil.geoserverConfigured=true
1549
           </echo>
1550
  </target>
1551
        
1552
        <!-- This target will use default values in svn metacat.properties to build a configured 
1553
                metacat (except configuti.* properties, they will be set true). Those default settings
1554
                are for a test machine. It may not work on your system-->
1555
        <target name="install-configured-metacat" depends="change-metacat-properties, install"
1556
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1557
    </target>
1558
        
1559
</project>