Project

General

Profile

metacat / build.xml @ 8265

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: leinfelder $'
10
        *    '$Date: 2013-09-23 15:54:55 -0700 (Mon, 23 Sep 2013) $'
11
        *    '$Revision: 8265 $'
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|documentation]
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
        <!-- Allow integration with Git projects -->
52
        <macrodef name = "git">
53
            <attribute name = "command" />
54
            <attribute name = "dir" default = "" />
55
            <element name = "args" optional = "true" />
56
            <sequential>
57
                <echo message = "git @{command}" />
58
                <exec executable = "git" dir = "@{dir}">
59
                    <arg value = "@{command}" />
60
                    <args/>
61
                </exec>
62
            </sequential>
63
        </macrodef>
64
        <macrodef name = "git-clone-pull">
65
            <attribute name = "repository" />
66
            <attribute name = "dest" />
67
            <attribute name = "refname" />
68
            <sequential>
69
                <git command = "clone">
70
                    <args>
71
                        <arg value = "@{repository}" />
72
                        <arg value = "@{dest}" />
73
                    </args>
74
                </git>
75
                <git command = "pull" dir = "@{dest}" >
76
                        <args>
77
                        <arg value = "@{repository}" />
78
                        <arg value = "@{refname}" />
79
                    </args>
80
                </git>
81
                <git command = "checkout" dir = "@{dest}">
82
                        <args>
83
                        <arg value = "@{refname}" />
84
                    </args>
85
                </git>
86
            </sequential>
87
        </macrodef>
88
        
89
        <!-- get metacatUI project -->
90
        <target name="getMetacatUI" depends="init">
91
                <git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" refname="${metacatui.git.repository.refname}" />
92
        </target>
93
        
94
        <target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" unless="build-metacat-ui-called">
95
                <artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
96
                        <arg value="clean"/>
97
                </artifact:mvn>
98
                <artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
99
                   <arg value="package"/>
100
                </artifact:mvn>
101
                <property name="build-metacat-ui-called" value="true"/>
102
        </target>
103
        
104
        <target name="dist-metacat-ui" depends="build-metacat-ui">
105
                <copy tofile="${dist.dir}/metacatui.war" >
106
                        <fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
107
                </copy>        
108
        </target>
109
            
110
        <taskdef resource="axis-tasks.properties"
111
                classpathref="axis.ant.classpath" />
112
        
113
        <!-- Determine if ecogrid should be installed-->
114
        <condition property="enable.ecogrid">
115
                <equals arg1="${install.ecogrid}" arg2="true" />
116
        </condition>
117

    
118
        <!-- Determine if perl should be built-->
119
        <condition property="build.perl">
120
                <equals arg1="${make.perl.code}" arg2="true" />
121
        </condition>
122

    
123
        <available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
124
                        property="tomcat.common.exists" />
125

    
126
        <target name="config" depends="setTomcatCommon, setTomcatNoCommon">
127
                <!-- usr for client testing, generally you don't need change-->
128
                <property name="mcuser"
129
                        value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
130
                <property name="mcpassword" value="kepler" />
131
                <property name="mcanotheruser"
132
                        value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
133
                <property name="mcanotherpassword" value="yourpass" />
134
                <property name="piscouser"
135
                        value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
136
                <property name="piscopassword" value="yourpass" />
137
                <property name="lteruser"
138
                        value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
139
                <property name="lterpassword" value="yourpass" />
140

    
141
                <property name="debug" value="on" />
142
                <property name="morphosourcedir" value="../morpho" />
143
                <property name="utilitiesdir" value="../utilities" />
144
                <property name="installdir"
145
                        value="${app.deploy.dir}/${metacat.context}" />
146

    
147
                <echo>*********** set jsdk to ${jsdk}</echo>
148
        </target>
149
        
150
        <target name="setTomcatCommon" if="tomcat.common.exists" >
151
                <property name="jsdk"
152
                        value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
153
        </target>
154
        
155
        <target name="setTomcatNoCommon" unless="tomcat.common.exists" >
156
                <property name="jsdk"
157
                        value="${build.tomcat.dir}/lib/servlet-api.jar" />
158
        </target>
159
        
160
        <target name="init" depends="config, build-metacat-common" unless="init.called">
161
                
162
            <property name="libdir.mvn" value="lib/maven" />
163
                <mkdir dir="${libdir.mvn}"/>
164
                
165
                <path id="base.classpath">
166
                        <pathelement location="${jsdk}" />
167
            <pathelement location="lib" />
168
                        
169
                        <fileset dir="lib">
170
                                <include name="*.jar" />
171
                        </fileset>
172
                        
173
                        <fileset dir="lib/lsid_lib">
174
                                <include name="*.jar" />
175
                        </fileset>
176

    
177
                        <!-- Include everything from maven -->
178
                        <fileset dir="${libdir.mvn}">
179
                                <include name="*.jar" />
180
                        </fileset>
181

    
182
                </path>
183
                
184
                <path id="test.classpath">
185
                        <pathelement location="${jsdk}" />
186
                        <pathelement location="lib" />
187
                        <fileset dir="lib">
188
                                <include name="*.jar" />
189
                                <exclude name="maven-ant-tasks-2.1.0.jar" />
190
                        </fileset>
191
                        <fileset dir="lib/lsid_lib">
192
                                <include name="*.jar" />
193
                        </fileset>
194
                        <!-- Include maven -->
195
                        <fileset dir="${libdir.mvn}">
196
                                <include name="*.jar" />
197
                        </fileset>
198
                </path>
199
                
200
                <!-- define the maven tasks -->
201
                <taskdef uri="antlib:org.apache.maven.artifact.ant"
202
                               resource="org/apache/maven/artifact/ant/antlib.xml"
203
                               classpathref="base.classpath" />
204

    
205
                   <!-- Resolve maven dependencies -->
206
                <artifact:pom id="metacatPom" file="pom.xml" />
207
                <artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
208
                <artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
209
                                      
210
                   <!-- combine base and dependencies for the classpath -->
211
                   <path id="compile.classpath">
212
                           <path refid="base.classpath" />        
213
                           <path refid="dependency.classpath" />        
214
                </path>
215

    
216
                <!-- It is less likely you'll need to make any changes from here down,
217
                        but customization is possible -->
218
                <property name="name" value="metacat" />
219
                <property name="Name" value="MetaCat" />
220
                <property name="debugprefix" value="${Name}:" />
221
                <property name="release" value="${metacat.version}" />
222
                <tstamp>
223
                    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
224
                </tstamp>
225
                <property name="copyright" value="${copyrightyear} Regents of the University of California" />
226
                <property name="style-common-relpath" value="/style/common" />
227
                <property name="style-shared-relpath" value="/style/shared" />
228
                <property name="schema-relpath" value="/schema" />
229
                <property name="style-common-cvsrelpath"
230
                        value="lib${style-common-relpath}" />
231
                <property name="schema-cvsrelpath" value="lib${schema-relpath}" />
232
                <property name="style-skins-relpath" value="/style/skins" />
233
                <property name="util-module" value="utilities" />
234
                <!--<property name="utilities-tag" value="trunk" />-->
235
                <property name="utilities-tag" value="tags/UTILITIES_1_3_0" />
236
                <property name="seek-tag" value="tags/ECOGRID_1_2_2" />
237
                <property name="eml-module" value="eml" />
238
                <property name="eml-version" value="2.0.0beta6" />
239
                <property name="eml-beta4-version" value="2.0.0beta4" />
240
                <property name="eml-beta-tag"
241
                        value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
242
                <property name="eml-beta4-tag"
243
                                        value="RELEASE_EML_2_BETA_4" />
244
                <property name="eml2_0_0-schema-tag"
245
                        value="RELEASE_EML_2_0_0_UPDATE_1" />
246
                <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
247
                <property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
248
                <property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
249
                <property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />
250
                <property name="eml2_0_0namespace"
251
                        value="eml://ecoinformatics.org/eml-2.0.0" />
252
                <property name="eml2_0_1namespace"
253
                        value="eml://ecoinformatics.org/eml-2.0.1" />
254
                <property name="eml2_1_0namespace"
255
                        value="eml://ecoinformatics.org/eml-2.1.0" />
256
                <property name="eml2_1_1namespace"
257
                        value="eml://ecoinformatics.org/eml-2.1.1" />
258
                <property name="stmmlnamespace"
259
                        value="http://www.xml-cml.org/schema/stmml" />
260
                <property name="stmml11namespace"
261
                        value="http://www.xml-cml.org/schema/stmml-1.1" />
262
                <property name="eml-css" value="eml_xsl.css" />
263
                <property name="eml-module.default.css" value="default.css" />
264
                <property name="systemidserver" value="" />
265
                <property name="html-path" value="" />
266
                <property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
267

    
268

    
269
                <!-- Config for registry variables -->
270
                <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
271
                <property name="scope" value="obfs" />
272
                <property name="responseForm" value="genericResponse.tmpl" />
273
                <property name="entryForm" value="entryForm.tmpl" />
274
                <property name="guide" value="genericGuide.tmpl" />
275
                <property name="loginForm" value="loginForm.tmpl" />
276
                <property name="confirmData" value="confirmData.tmpl" />
277
                <property name="deleteData" value="deleteData.tmpl" />
278
                <property name="genericHeader" value="genericHeader.tmpl" />
279
                <property name="genericFooter" value="genericFooter.tmpl" />
280

    
281
                <filter token="scope" value="${scope}" />
282
                <filter token="responseForm" value="${responseForm}" />
283
                <filter token="entryForm" value="${entryForm}" />
284
                <filter token="guide" value="${guide}" />
285
                <filter token="loginForm" value="${loginForm}" />
286
                <filter token="confirmData" value="${confirmData}" />
287
                <filter token="deleteData" value="${deleteData}" />
288
                <filter token="genericHeader" value="${genericHeader}" />
289
                <filter token="genericFooter" value="${genericFooter}" />
290
                <filter token="adminname" value="${adminname}" />
291
                <filter token="recipient" value="${recipient}" />
292
                <filter token="metacatVersion" value="${metacat.version}" />
293
                <filter token="metacatRC" value="${metacat.releaseCandidate}" />
294
                <filter token="build.context" value="${metacat.context}" />
295

    
296
                <filter token="docrooturl" value="./" />
297
                <filter token="mcuser" value="${mcuser}" />
298
                <filter token="mcpassword" value="${mcpassword}" />
299
                <filter token="mcanotheruser" value="${mcanotheruser}" />
300
                <filter token="mcanotherpassword" value="${mcanotherpassword}" />
301
                <filter token="eml-css" value="${eml-css}" />
302
                <filter token="style-skins-relpath"
303
                        value="${style-skins-relpath}" />
304
                <filter token="style-common-relpath"
305
                        value="${style-common-relpath}" />
306

    
307
                <filter token="eml-version" value="${eml-version}" />
308
                <filter token="eml-beta4-version" value="${eml-beta4-version}" />
309
                <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
310
                <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
311
                <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
312
                <filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
313
                <filter token="stmmlnamespace" value="${stmmlnamespace}" />
314
                <filter token="stmml11namespace" value="${stmml11namespace}" />
315
                <filter token="debugprefix" value="${debugprefix}" />
316

    
317
                <filter token="defaultStage" value="${defaultStage}" />
318
                <filter token="defaultHeader" value="${defaultHeader}" />
319
                <filter token="defaultFooter" value="${defaultFooter}" />
320
                <filter token="defaultChangePass" value="${defaultChangePass}" />
321
                <filter token="defaultResetPass" value="${defaultResetPass}" />
322
                <filter token="changePassSuccess" value="${changePassSuccess}" />
323
                <filter token="resetPassSuccess" value="${resetPassSuccess}" />
324
                <filter token="registerFailed" value="${registerFailed}" />
325
                <filter token="registerLter" value="${registerLter}" />
326
                <filter token="registerMatch" value="${registerMatch}" />
327
                <filter token="registerSuccess" value="${registerSuccess}" />
328
                <filter token="register" value="${register}" />
329
                <filter token="searchResults" value="${searchResults}" />
330
                <filter token="ldapMainServerFailure"
331
                        value="${ldapMainServerFailure}" />
332
                <filter token="lter-user" value="${lteruser}" />
333
                <filter token="lter-pass" value="${lterpassword}" />
334
                <filter token="pisco-user" value="${piscouser}" />
335
                <filter token="pisco-pass" value="${piscopassword}" />
336

    
337

    
338
                <!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
339
                <!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
340
                <!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
341

    
342
                <property name="srcdir" value="./src" />
343
                <property name="lib.dir" value="./lib" />
344
                <property name="docdir" value="./docs" />
345
                <property name="cgidir" value="./cgi-bin" />
346
                <property name="testdir" value="./test" />
347
                <property name="testtorun" value="MNodeServiceTest" />
348
                <property name="junittestsdir"
349
                        value="./test/edu/ucsb/nceas/metacattest" />
350
                <property name="junitnettestsdir"
351
                        value="./test/edu/ucsb/nceas/metacatnettest" />
352
                <property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
353
                <property name="build.dir" value="./build" />
354
                <property name="build.src" value="${build.dir}/src" />
355
                <property name="build.dest" value="${build.dir}/classes" />
356
                <property name="build.samples" value="${build.dir}/samples" />
357
                <property name="build.tests" value="${build.dir}/tests" />
358
                <property name="build.tmp" value="${build.dir}/tmp" />
359
                <property name="build.metacattest"
360
                        value="${build.tests}/metacattest" />
361
                <property name="build.metacatnettest"
362
                        value="${build.tests}/metacatnettest" />
363
                <property name="build.data" value="${build.dir}/data" />
364
                <property name="build.docs" value="${build.dir}/docs" />
365
                <property name="build.javadocs" value="${build.docs}/api" />
366
                <property name="build.war" value="${build.dir}/war" />
367
                <property name="dist.dir" value="dist" />
368
                <property name="ver.dir" value="${dist.dir}/${name}-${release}" />
369
                <property name="ver.src" value="${ver.dir}/src" />
370
                <property name="util.dir" value="${dist.dir}/${util-module}" />
371
                <property name="test.dir" value="${dist.dir}/test" />
372
                <!-- directories for creating a Harvest List Editor distribution -->
373
                <property name="dist.dir.hle" value="disthle" />
374
                <property name="ver.dir.hle"
375
                        value="${dist.dir.hle}/harvest-list-editor-${release}" />
376
                <property name="pkg.dir" value="./package" />
377
                <property name="deb.pkg.dir" value="${pkg.dir}/debian" />
378

    
379
                <property name="ecogrid-target-name" value="metacatImpl" />
380
                <property name="ecogrid-module-dest-dir" value=".." />
381
                <property name="ecogrid-module" value="seek/projects/ecogrid" />
382
                <property name="ecogrid-dist-dir"
383
                        value="${dist.dir}/${ecogrid-module}" />
384
                <property name="ecogrid-dir"
385
                        value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
386

    
387
                <property name="package.home" value="edu/ucsb/nceas/metacat" />
388

    
389
                <!-- set up svn -->
390
                <property name="svnant.lib" value="lib" />
391
                <property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
392
                <property name="svnClientAdapter.jar"
393
                        value="${svnant.lib}/svnClientAdapter.jar" />
394
                <property name="svnjavahl.jar"
395
                        value="${svnant.lib}/svnjavahl.jar" />
396
                <property name="svn.utilitiesUrl"
397
                        value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
398
                <property name="svn.ecogridUrl"
399
                        value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
400
                <property name="svn.emlBetaUrl"
401
                        value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
402
                <property name="svn.emlBeta4Url"
403
                                        value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
404
                <property name="svn.eml200SchemaUrl"
405
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
406
                <property name="svn.eml201SchemaUrl"
407
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
408
                <property name="svn.eml210SchemaUrl"
409
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
410
                <property name="svn.eml211SchemaUrl"
411
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
412
                <property name="svn.eml2StyleUrl"
413
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
414
                
415
                <!-- the git repo -->
416
                <property name="metacatui.git.repository.url"
417
                                        value="https://github.com/NCEAS/metacatui.git" />
418
                <property name="metacatui.git.repository.refname"
419
                                                        value="master" />
420
                <property name="metacatui.build.dir"
421
                                        value="metacatui_build" />
422
                <property name="metacatui.resources.dir"
423
                                        value="${metacatui.build.dir}/metacatui/src/main/webapp" />
424
                
425
                <!-- load the svn task -->
426
                <path id="svn.classpath">
427
                        <pathelement location="${svnjavahl.jar}" />
428
                        <pathelement location="${svnant.jar}" />
429
                        <pathelement location="${svnClientAdapter.jar}" />
430
                </path>
431
                <taskdef resource="svntask.properties"
432
                        classpathref="svn.classpath" />
433

    
434
                <condition property="utilities.required">
435
                        <not>
436
                                <available file="lib/utilities.jar" />
437
                        </not>                                
438
                </condition>
439
                <!-- peer.utilities.required is used when there is no utilities 
440
                        directory at ${utilitiesdir} -->
441
                <condition property="peer.utilities.required">
442
                        <or>
443
                                <not>
444
                                        <available file="${utilitiesdir}" type="dir" />
445
                                </not>
446
                        </or>
447
                </condition>
448
                <condition property="eml.required">
449
                        <or>
450
                                <not>
451
                                        <available file="lib/schema/eml-2.0.1/eml.xsd" />
452
                                </not>
453
                                <not>
454
                                        <available file="lib/schema/eml-2.0.0/eml.xsd" />
455
                                </not>
456
                                <not>
457
                                        <available file="lib/schema/eml-2.1.0/eml.xsd" />
458
                                </not>
459
                                <not>
460
                                        <available
461
                                                file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
462
                                </not>
463
                        </or>
464
                </condition>
465

    
466
                <condition property="ecogrid.required">
467
                        <or>
468
                                <not>
469
                                        <available file="${ecogrid-dir}/build.properties" />
470
                                </not>
471
                                <not>
472
                                        <available
473
                                                file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
474
                                </not>
475
                        </or>
476
                </condition>
477
                
478
                <property name="init.called" value="true" />
479

    
480
        </target>
481
        
482
        <target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
483
                        <echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
484
                        <!-- Clear out mvn dir -->
485
                        <delete dir="${libdir.mvn}"></delete>
486
                        <!-- Copy all dependencies to the correct location. -->
487
                        <copy todir="${libdir.mvn}">
488
                                <fileset refid="dependency.fileset" />
489
                                <!-- This mapper strips off all leading directory information -->
490
                                <mapper type="flatten" />
491
                        </copy>
492
                </target>
493

    
494
        <target name="prepare" depends="init, resolveDependencies">
495
                <mkdir dir="${build.dir}" />
496
                <mkdir dir="${build.src}" />
497
                <mkdir dir="${build.dest}" />
498
                <mkdir dir="${build.docs}" />
499
                <mkdir dir="${build.javadocs}" />
500
                <mkdir dir="${build.tmp}" />
501

    
502
                <copy todir="${build.src}" filtering="yes">
503
                        <fileset dir="${srcdir}">
504
                                <include name="edu/**" />
505
                                <include name="com/**" />
506
                                <include name="org/**" />
507
                                <!-- include name="java/**" / -->
508
                                <include name="**/*.sql" />
509
                                <exclude name="**/CVS*" />
510
                                <exclude name="**/.#*" />
511
                                <exclude name="edu/ucsb/nceas/workflowscheduler/**" />
512
                        </fileset>
513
                </copy>
514
                <available file="lib/style/common/emlb6toeml2" type="dir"
515
                        property="styles.not.needed" />
516
        </target>
517

    
518
        <target name="generateStubs" depends="prepare">
519
                <echo
520
                        message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
521
                <axis-wsdl2java verbose="true" output="${srcdir}"
522
                        url="/tmp/KeplerWebService.wsdl" />
523
        </target>
524

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

    
528
                <javac srcdir="${build.src}" destdir="${build.dest}"
529
                        debug="${debug}"
530
                        excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
531
                        <classpath>
532
                                <path refid="compile.classpath" />
533
                        </classpath>
534
                </javac>
535
        </target>
536

    
537
        <target name="jar" depends="compile,geteml"
538
                description="Compiles and jars metacat java code to metacat.jar in build dir ">
539

    
540
                <delete file="${build.dir}/${name}.jar" />
541
                <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
542
                        excludes="**/protocols/ **/harvesterClient/" />
543
        </target>
544

    
545
        <target name="protocol" depends="compile"
546
                description="Compiles and jars protocol java code to protocol.jar in build dir">
547
                <delete file="${build.dir}/protocol.jar" />
548
                <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
549
                        includes="**/protocols/" />
550
        </target>
551

    
552
        <target name="utilities" depends="config,getpeerutilities"
553
                if="utilities.required">
554
                <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
555
                <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
556
                <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
557
        </target>
558

    
559
        <target name="getpeerutilities" depends="prepare"
560
                if="peer.utilities.required"
561
                description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
562
                <echo message="Exporting utilities files from svn repository:" />
563
                <svn>
564
                        <export srcUrl="${svn.utilitiesUrl}"
565
                                destPath="${utilitiesdir}" />
566
                </svn>
567

    
568
                <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
569
        </target>
570
        
571
        <target name="getutilities" depends="prepare"
572
                description="Checks utility out of svn and copies it to your metacat sandbox">
573
                <svn>
574
                        <export srcUrl="${svn.utilitiesUrl}"
575
                                destPath="${utilitiesdir}" force="true" />
576
                </svn>
577
        </target>
578

    
579
        <target name="client" depends="utilities, prepare"
580
                description="Compiles metacat-client java code to build dir">
581
                <javac srcdir="${build.src}" destdir="${build.dest}"
582
                        includes="edu/ucsb/nceas/metacat/client/*">
583
                        <classpath>
584
                                <path refid="compile.classpath" />
585
                        </classpath>
586
                </javac>
587
        </target>
588

    
589
        <target name="clientjar" depends="client"
590
                description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
591
                <delete file="${build.dir}/${name}-client.jar" />
592
                <jar jarfile="${build.dir}/${name}-client.jar"
593
                        basedir="${build.dest}" includes="**/metacat/client/" />
594
        </target>
595

    
596
        <target name="advancedsearchjar" depends="compile"
597
                description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
598
                <delete file="${build.dir}/advancedsearch.jar" />
599
                <jar jarfile="${build.dir}/advancedsearch.jar"
600
                        basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
601
        </target>
602

    
603
        <target name="harvester" depends="client"
604
                description="Compiles harvester java code to build dir">
605
                <javac srcdir="${build.src}" destdir="${build.dest}"
606
                        includes="edu/ucsb/nceas/metacat/harvesterClient/*">
607
                        <classpath>
608
                                <path refid="compile.classpath" />
609
                        </classpath>
610
                </javac>
611
        </target>
612
                
613
        <target name="harvesterjar" depends="harvester"
614
                description="Compiles and jars harvester java code to harvester.jar in build dir">
615
                <delete file="${build.dir}/harvester.jar" />
616
                <jar jarfile="${build.dir}/harvester.jar"
617
                        basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
618
        </target>
619

    
620
        <target name="harvestListEditorDist" depends="harvesterjar"
621
                description="Prepares a distribution of the Harvest List Editor tool">
622
                <mkdir dir="${dist.dir.hle}" />
623
                <delete dir="${ver.dir.hle}" />
624
                <mkdir dir="${ver.dir.hle}" />
625
                <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
626
                <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
627
                <copy todir="${ver.dir.hle}"
628
                        file="lib/harvester/harvestList.xsd" />
629
                <copy todir="${ver.dir.hle}"
630
                        file="lib/harvester/harvestListEditor.bat" />
631
                <copy todir="${ver.dir.hle}"
632
                        file="lib/harvester/harvestListEditor.sh" />
633
                <delete file="./harvest-list-editor-${release}.zip" />
634
                <zip zipfile="./harvest-list-editor-${release}.zip"
635
                        basedir="${ver.dir.hle}" />
636
                <delete file="./harvest-list-editor-${release}.tar.gz" />
637
                <tar tarfile="./harvest-list-editor-${release}.tar"
638
                        basedir="${ver.dir.hle}" />
639
                <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
640
                        src="./harvest-list-editor-${release}.tar" />
641
                <delete file="./harvest-list-editor-${release}.tar" />
642
        </target>
643

    
644
        <target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
645
                if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
646

    
647
        <target name="getemlpre2" depends="prepare" if="eml.required"
648
                description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
649
                <svn>
650
                        <export srcUrl="${svn.emlBetaUrl}"
651
                                destPath="${build.tmp}/eml_${eml-beta-tag}" />
652
                </svn>
653
                <mkdir dir="lib/dtd" />
654
                <copy todir="lib/dtd" filtering="yes">
655
                        <fileset
656
                                dir="${build.tmp}/eml_${eml-beta-tag}">
657
                                <include name="*.dtd" />
658
                        </fileset>
659
                        <mapper type="glob" from="eml-*.dtd"
660
                                to="eml-*-${eml-version}.dtd" />
661
                </copy>
662

    
663
                <copy todir="${style-common-cvsrelpath}" filtering="yes">
664
                        <fileset
665
                                dir="${build.tmp}/eml_${eml-beta-tag}/style">
666
                                <include name="**/*.xsl" />
667
                        </fileset>
668
                </copy>
669
        </target>
670
        
671
        <target name="getemlpre2beta4" depends="prepare" if="eml.required"
672
                        description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
673
                        <svn>
674
                                <export srcUrl="${svn.emlBeta4Url}"
675
                                        destPath="${build.tmp}/eml_${eml-beta4-tag}" />
676
                        </svn>
677
                        <mkdir dir="lib/dtd" />
678
                        <copy todir="lib/dtd" filtering="yes">
679
                                <fileset
680
                                        dir="${build.tmp}/eml_${eml-beta4-tag}">
681
                                        <include name="*.dtd" />
682
                                </fileset>
683
                                <mapper type="glob" from="eml-*.dtd"
684
                                        to="eml-*-${eml-beta4-version}.dtd" />
685
                        </copy>
686

    
687
                        <!--
688
                        <copy todir="${style-common-cvsrelpath}" filtering="yes">
689
                                <fileset
690
                                        dir="${build.tmp}/eml_${eml-beta4-tag}/style">
691
                                        <include name="**/*.xsl" />
692
                                </fileset>
693
                        </copy>
694
                        -->
695
                </target>
696

    
697
        <target name="geteml2+" depends="prepare" if="eml.required"
698
                description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
699
                <svn>
700
                        <export srcUrl="${svn.eml200SchemaUrl}"
701
                                destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
702
                </svn>
703
                <mkdir dir="lib/schema/eml-2.0.0" />
704
                <copy todir="lib/schema/eml-2.0.0" filtering="yes">
705
                        <fileset
706
                                dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
707
                                <include name="*.xsd" />
708
                        </fileset>
709

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

    
716
                </copy>
717
                <!-- <antcall target="copyxsl">
718
                        <param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
719
                        <param name="dirname" value="eml-2.0.0" />
720
                        </antcall> -->
721

    
722
                <!-- Checkout eml201 for given schema tag-->
723
                <svn>
724
                        <export srcUrl="${svn.eml201SchemaUrl}"
725
                                destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
726
                </svn>
727
                <mkdir dir="lib/schema/eml-2.0.1" />
728
                <copy todir="lib/schema/eml-2.0.1" filtering="yes">
729
                        <fileset
730
                                dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
731
                                <include name="*.xsd" />
732
                        </fileset>
733
                </copy>
734

    
735
                <!-- Checkout eml201 again for given style sheet tag-->
736
                <!-- echo>Enter CVS password: </echo>
737
                        <cvs cvsRoot="${cvsroot}"
738
                        package="${eml-module}"
739
                        tag="${eml2_0_1-style-tag}"
740
                        dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
741
                        <antcall target="copyxsl">
742
                        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
743
                        <param name="dirname" value="eml-2.0.1" />
744
                        </antcall -->
745

    
746
                <!-- Checkout eml210 for given schema tag-->
747
                <svn>
748
                        <export srcUrl="${svn.eml210SchemaUrl}"
749
                                destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
750
                </svn>
751
                <mkdir dir="lib/schema/eml-2.1.0" />
752
                <copy todir="lib/schema/eml-2.1.0" filtering="yes">
753
                        <fileset
754
                                dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
755
                                <include name="*.xsd" />
756
                        </fileset>
757
                </copy>
758

    
759
                <!-- Checkout eml210 for given style sheet tag-->
760
                <svn>
761
                        <export srcUrl="${svn.eml2StyleUrl}"
762
                                destPath="${build.tmp}/eml_${eml2-style-tag}" />
763
                </svn>
764
                <antcall target="copyxsl">
765
                        <param name="cvs.tagname" value="${eml2-style-tag}" />
766
                        <!-- param name="dirname" value="eml-2.1.0" / -->
767
                        <param name="dirname" value="eml-2" />
768
                </antcall>
769
                
770
                <!-- Checkout eml210 for given schema tag-->
771
                <svn>
772
                        <export srcUrl="${svn.eml211SchemaUrl}"
773
                                destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
774
                </svn>
775
                <mkdir dir="lib/schema/eml-2.1.1" />
776
                <copy todir="lib/schema/eml-2.1.1" filtering="yes">
777
                        <fileset
778
                                dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
779
                                <include name="*.xsd" />
780
                        </fileset>
781
                </copy>
782
        </target>
783

    
784
        <target name="copyxsl"
785
                description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
786

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

    
789
                <copy todir="${style-common-cvsrelpath}/${dirname}"
790
                        filtering="yes">
791
                        <fileset
792
                                dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
793
                                <include name="**/*.xsl" />
794
                        </fileset>
795
                </copy>
796

    
797

    
798
                <!-- now copy default css from eml module and put it in style-common-path
799
                        dir with a new name, so other skin-specific css can import it if reqd -->
800
                <copy
801
                        file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
802
                        tofile="${style-common-cvsrelpath}/${eml-css}" />
803

    
804
        </target>
805

    
806
        <target name="correctEML201Docs" depends="jar"
807
                description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
808
                <copy todir="${build.dir}" file="lib/metacat.properties"
809
                        filtering="yes" />
810
                <java
811
                        classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
812
                        <classpath>
813
                                <path refid="compile.classpath" />
814
                                <fileset dir="${build.dir}">
815
                                        <include name="${name}.jar" />
816
                                </fileset>
817
                        </classpath>
818
                </java>
819
        </target>
820

    
821
        <target name="install-spatial" depends="jar,clientjar,harvesterjar"
822
                description="Installs spatial option for metacat">
823
                
824
                <copy todir="${dist.dir}">
825
                        <fileset dir="./lib/spatial/geoserver" includes="*.war" />
826
                </copy>
827

    
828
        </target>
829

    
830
        <target name="install" depends="build-metacat"
831
                description="* Install Metacat For Development *">
832
                <copy file="${dist.dir}/${metacat.context}.war"
833
                        todir="${app.deploy.dir}" />
834
                <delete dir="${app.deploy.dir}/${metacat.context}" />
835
                <copy file="${dist.dir}/geoserver.war"
836
                                        todir="${app.deploy.dir}" />
837
                <delete dir="${app.deploy.dir}/geoserver" />
838
                <copy file="${dist.dir}/metacat-index.war"
839
                                        todir="${app.deploy.dir}" />
840
                <delete dir="${app.deploy.dir}/metacat-index" />
841
                <copy file="${dist.dir}/metacatui.war"
842
                                        todir="${app.deploy.dir}" />
843
                <delete dir="${app.deploy.dir}/metacatui" />
844
                <tstamp>
845
                        <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
846
                </tstamp>
847
                <echo>Dev install completed at ${NOW}</echo>
848
        </target>
849

    
850
        <target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
851
                description="Build Metacat">
852
        </target>
853

    
854
        <target name="install-ecogrid" depends="warPrepare, get-ecogrid"
855
                if="enable.ecogrid" description="Install Ecogrid Compentent">
856
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
857
                        inheritall="false">
858
                        <property name="context" value="${metacat.context}" />
859
                        <property name="target" value="${ecogrid-target-name}" />
860
                </ant>
861
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
862
                        inheritall="false">
863
                        <property name="context" value="${metacat.context}" />
864
                        <property name="target" value="${ecogrid-target-name}" />
865
                        <property name="metacat.dir" value="${basedir}"/>
866
                </ant>
867
                <!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
868
                        <webinf dir="${ecogrid-dir}/lib">
869
                        <include name="server-config.wsdd"/>
870
                        </webinf>
871
                        </war -->
872
                <copy file="${ecogrid-dir}/build/${metacat.context}.war"
873
                        todir="${dist.dir}" overwrite="true" />
874

    
875

    
876
        </target>
877

    
878
        <target name="get-ecogrid" depends="init"
879
                description="Check out ecogrid module" if="ecogrid.required">
880
                <svn>
881
                        <export srcUrl="${svn.ecogridUrl}" force="true"
882
                                destPath="${ecogrid-dir}" />
883
                </svn>
884
        </target>
885

    
886
        <!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
887
                <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
888
                <property name="context" value="${metacat.context}"/>
889
                <property name="target" value="${ecogrid-target-name}"/>
890
                <property name="metacat.dir" value="."/>
891
                <property name="hostname" value="${ecogrid.hostname}"/>
892
                <property name="port" value="${config.port}"/>
893
                </ant>
894
                </target -->
895

    
896
        <target name="clean-ecogrid-server-config-wsdd" depends="init"
897
                description="Automately generate wsdd for ecogrid service">
898
                <delete
899
                        file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
900
        </target>
901

    
902
        <target name="install-skin" depends="init"
903
                description="Install a Skin">
904

    
905
                <input message="Please enter name of the skin"
906
                        addproperty="skin-name" />
907

    
908
                <mkdir dir="${installdir}/style/skins/${skin-name}" />
909
                <copy todir="${installdir}/style/skins/${skin-name}"
910
                        filtering="yes">
911
                        <fileset dir="lib/style/skins/${skin-name}">
912
                                <exclude name="**/*.png" />
913
                                <exclude name="**/*.gif" />
914
                                <exclude name="**/*.jpg" />
915
                                <exclude name="**/CVS*" />
916
                                <exclude name="**/.#*" />
917
                        </fileset>
918
                </copy>
919
                <copy todir="${installdir}/style/skins/${skin-name}"
920
                        filtering="no">
921
                        <fileset dir="lib/style/skins/${skin-name}">
922
                                <include name="**/*.png" />
923
                                <include name="**/*.gif" />
924
                                <include name="**/*.jpg" />
925
                                <exclude name="**/CVS*" />
926
                                <exclude name="**/.#*" />
927
                        </fileset>
928
                </copy>
929
                <copy todir="${installdir}/style/common" filtering="yes">
930
                        <fileset dir="lib/style/common">
931
                                <include name="*.js" />
932
                                <include name="*.jsp" />
933
                                <include name="*.css" />
934
                                <exclude name="*.png" />
935
                                <exclude name="*.gif" />
936
                                <exclude name="*.jpg" />
937
                                <exclude name="**/CVS*" />
938
                                <exclude name="**/.#*" />
939
                        </fileset>
940
                </copy>
941
                <!--
942
                        <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
943
                        <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
944
                        <fileset dir="lib/style/skins/${skin-name}/images">
945
                        <include name="*.png"/>
946
                        <include name="*.gif"/>
947
                        <include name="*.jpg"/>
948
                        </fileset>
949
                        </copy>
950
                -->
951

    
952
                <echo message="Install Skin completed." />
953
        </target>
954

    
955
        <target name="war" depends="warPrepare,install-spatial"
956
                description="Create a web archive (WAR) for servlet deployment">
957
                <mkdir dir="${dist.dir}" />
958
                <war destfile="${dist.dir}/${metacat.context}.war"
959
                        webxml="${build.war}/web.xml">
960
                        <fileset dir="${war.context}" />
961
                        <lib dir="${war.lib}" />
962
                        <webinf dir="${war.webinf}" />
963
                </war>
964
        </target>
965

    
966
        <target name="warPrepare"
967
                depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
968
                description="Prepare files for creating a web archive (WAR)">
969

    
970
                <property name="war.lib" value="${build.war}/lib" />
971
                <property name="war.webinf" value="${build.war}/WEB-INF" />
972
                <property name="war.context"
973
                        value="${build.war}/${metacat.context}" />
974
                <property name="war.webinf.sql" value="${war.webinf}/sql" />
975
                <property name="war.webinf.scripts"
976
                        value="${war.webinf}/scripts" />
977
                <property name="war.context.cgi" value="${war.context}/cgi-bin" />
978
                <property name="war.context.docs" value="${war.context}/docs" />
979
                <property name="war.context.temp" value="${war.context}/temp" />
980
                <property name="war.context.templates"
981
                        value="${war.context}${style-common-relpath}/templates" />
982
                <mkdir dir="${war.lib}" />
983
                <mkdir dir="${war.webinf}" />
984
                <mkdir dir="${war.context}" />
985
                <mkdir dir="${war.webinf.sql}" />
986
                <mkdir dir="${war.context.cgi}" />
987
                <mkdir dir="${war.context.docs}" />
988
                <mkdir dir="${war.context.temp}" />
989
                <mkdir dir="${war.context.templates}" />
990

    
991
                <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
992
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
993
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
994
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
995
                <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
996
                <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
997
                <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
998
                <copy todir="${war.lib}" filtering="no">
999
                        <fileset dir="lib">
1000
                                <include name="*.jar" />
1001
                                <exclude name="maven-ant-tasks*.jar" />
1002
                        </fileset>
1003
                        <fileset dir="${libdir.mvn}" />                        
1004
                </copy>
1005
                <!-- MCD copy file="lib/web.xml.${tomcatversion}"
1006
                        tofile="${build.war}/web.xml" / -->
1007
                <!-- MCD added next - Remove the tomcat5 reference-->
1008
                <copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
1009
                <copy file="lib/metacat.properties" todir="${war.webinf}"
1010
                        filtering="yes" />
1011
                <copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
1012
                <copy file="lib/metacat.properties.metadata.xml"
1013
                        todir="${war.webinf}" filtering="no" />
1014
                <copy file="lib/org.properties.metadata.xml"
1015
                        todir="${war.webinf}" filtering="no" />
1016
                <copy file="lib/auth.properties.metadata.xml"
1017
                        todir="${war.webinf}" filtering="no" />
1018
                <copy todir="${war.webinf}" filtering="yes">
1019
                        <fileset dir="lib">
1020
                                <include name="skin.configs/**" />
1021
                        </fileset>
1022
                </copy>
1023
                <copy file="lib/log4j.properties" todir="${war.webinf}"
1024
                        filtering="yes" />
1025
                <copy file="lib/hazelcast.xml" todir="${war.webinf}"
1026
                        filtering="yes" />
1027
                <copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
1028
                        filtering="yes" />
1029
                <copy todir="${war.context}" filtering="no">
1030
                        <fileset dir="lib">
1031
                                <include name="**/*.jpg" />
1032
                                <include name="**/*.png" />
1033
                                <include name="**/*.gif" />
1034
                                <include name="LiveMap_30/**" />
1035
                                <include name="oaipmh/**" />
1036
                        </fileset>
1037
                </copy>
1038
                <copy todir="${war.context}" filtering="yes">
1039
                        <fileset dir="lib">
1040
                                <exclude name="*.jar" />
1041
                                <exclude name="*.properties" />
1042
                                <exclude name="*.metadata.xml" />
1043
                                <exclude name="web.xml" />
1044
                                <exclude name="**/*.jpg" />
1045
                                <exclude name="**/*.png" />
1046
                                <exclude name="**/*.gif" />
1047
                                <exclude name="lsid_lib/**" />
1048
                                <exclude name="lsid_conf/**" />
1049
                                <exclude name="LiveMap_30/**" />
1050
                                <exclude name="oaipmh/**" />
1051
                                <exclude name="maven/**" />
1052
                                <exclude name="skin.configs/**" />
1053
                                <exclude name="spatial/geoserver/**" />
1054
                        </fileset>
1055
                </copy>
1056
                <copy todir="${war.context}" filtering="no">
1057
                        <fileset dir="lib">
1058
                                <include name="spatial/geoserver/data/**" />
1059
                        </fileset>
1060
                </copy>
1061
                <copy todir="${war.context.docs}" filtering="no">
1062
                        <fileset dir="${build.docs}" />
1063
                </copy>
1064
                <copy todir="${war.webinf.sql}" filtering="yes">
1065
                        <fileset dir="src">
1066
                                <include name="**/*.sql" />
1067
                        </fileset>
1068
                </copy>
1069
                <copy todir="${war.webinf.scripts}" filtering="yes">
1070
                        <fileset dir="src/scripts" />
1071
                </copy>
1072
                <copy todir="${war.webinf.scripts}"
1073
                        file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1074
                        failonerror="false" />
1075

    
1076
                <copy file="src/perl/register-dataset.cgi"
1077
                        todir="${war.context.cgi}" />
1078
                <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1079
                <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1080

    
1081
                <!-- registry cgi section -->
1082
                <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1083
                        used in readDocumentFromMetacat -->
1084
                <!-- TODO MCD copy temp files to actual location using config util?? -->
1085
                <copy todir="${war.context.temp}" filtering="yes">
1086
                        <fileset dir="lib/style/common/emlb6toeml2">
1087
                                <include name="*.xsl" />
1088
                                <include name="*.xml" />
1089
                        </fileset>
1090
                </copy>
1091
                <available file="lib/style/common/emlb6toeml2" type="dir"
1092
                        property="styles.not.needed" />
1093

    
1094
                <!-- ldap cgi section -->
1095
                <copy todir="${war.context.templates}">
1096
                        <fileset dir="lib/style/common/templates">
1097
                                <!-- SCW: Copy all files -->
1098
                        </fileset>
1099
                </copy>
1100
        </target>
1101

    
1102
        <target name="cgiPrepare" if="build.perl">
1103
                <exec dir="src/perl/Metacat/" executable="make">
1104
                        <arg value="clean" />
1105
                </exec>
1106
                <exec dir="src/perl/Metacat/" executable="perl">
1107
                        <arg value="Makefile.PL" />
1108
                </exec>
1109
                <exec dir="src/perl/Metacat/" executable="make" />
1110
        </target>
1111

    
1112
        <target name="testPrepare"
1113
                description="Copies test files into the war directories">
1114
                <echo>in testPrepare</echo>
1115
                <property name="war.context.test"
1116
                        value="${build.war}/${metacat.context}/test" />
1117
                <mkdir dir="${war.context.test}" />
1118
                <copy todir="${war.context.test}" filtering="yes">
1119
                        <fileset dir="test/servertestfiles">
1120
                                <include name="*/**" />
1121
                        </fileset>
1122
                </copy>
1123
        </target>
1124

    
1125
        <target name="getConversionXSL" depends="prepare"
1126
                unless="styles.not.needed"
1127
                description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1128

    
1129
                <svn>
1130
                        <export srcUrl="${svn.eml2StyleUrl}"
1131
                                destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1132
                </svn>
1133

    
1134
                <mkdir dir="lib/style/common/emlb6toeml2" />
1135
                <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1136
                        <fileset
1137
                                dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1138
                                <include name="*.xsl" />
1139
                                <include name="*.xml" />
1140
                        </fileset>
1141
                </copy>
1142
        </target>
1143

    
1144
        <target name="testprep" depends="jar,clientjar,harvesterjar">
1145
                <mkdir dir="${build.tests}" />
1146
                <copy todir="${build.tests}" encoding="UTF-8">
1147
                        <fileset dir="${testdir}">
1148
                                <include name="edu/**" />
1149
                        </fileset>
1150
                </copy>
1151
                <copy todir="${build.tests}" file="${testdir}/test.properties" />
1152

    
1153
                <path id="test.classpath">
1154
                        <path refid="compile.classpath" />
1155
                        <fileset dir="${build.dir}">
1156
                                <include name="${name}.jar" />
1157
                                <include name="${name}-client.jar" />
1158
                                <include name="harvester.jar" />
1159
                        </fileset>
1160
                </path>
1161
                
1162
                <pathconvert pathsep="${line.separator}|  |--" 
1163
                             property="echo.test.classpath"
1164
                             refid="test.classpath">
1165
                </pathconvert>
1166
                <echo message="|--test classpath" />
1167
                <echo message="|  |" />
1168
                <echo message="|  |-- ${echo.test.classpath}" />
1169
                
1170
                <!-- copy and compile the tests into a jar file -->
1171
                <javac srcdir="${build.tests}" destdir="${build.tests}"
1172
                        debug="on" includes="**/*.java" encoding="UTF-8">
1173
                        <classpath refid="test.classpath" />
1174
                </javac>
1175

    
1176
                <jar jarfile="${build.dir}/${name}-junittests.jar"
1177
                        basedir="${build.tests}" >
1178
                        <include name="**/*.class"/>
1179
                        <include name="**/*.xml"/>
1180
                </jar>        
1181
                
1182
        </target>
1183

    
1184
        <target name="runoneclass" depends="testprep"
1185
                description="Uses the ant to run a class">
1186
                
1187
                <java classname="${classtorun}" fork="true">
1188
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1189
                        <classpath>
1190
                                <path refid="test.classpath" />
1191
                                <fileset dir="${build.dir}">
1192
                                        <include name="${name}.jar" />
1193
                                        <include name="${name}-client.jar" />
1194
                                        <include name="harvester.jar" />
1195
                                        <include name="${name}-junittests.jar" />
1196
                                </fileset>
1197
                        </classpath>
1198
                </java>
1199
        </target>
1200
        
1201
        <target name="test" depends="testprep"
1202
                description="Uses the ant junit task to run all JUnit tests">
1203

    
1204
                <!-- use the ant "junit" task to run JUnit tests. -->
1205
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1206
                        haltonerror="no">
1207
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1208
                        <classpath>
1209
                                <path refid="test.classpath" />
1210
                                <fileset dir="${build.dir}">
1211
                                        <include name="${name}.jar" />
1212
                                        <include name="${name}-client.jar" />
1213
                                        <include name="harvester.jar" />
1214
                                        <include name="${name}-junittests.jar" />
1215
                                </fileset>
1216
                        </classpath>
1217

    
1218
                        <formatter type="plain" />
1219

    
1220
                        <batchtest fork="yes" todir="${build.dir}">
1221
                                <fileset dir="${build.tests}">
1222
                                        <include name="**/*.class" />
1223
                                        <exclude name="**/MCTestCase.class" />
1224
                                        <exclude name="**/ClientViewHelperTest.class" />
1225
                                        <!-- these are not test cases -->
1226
                                        <exclude name="**/MockCNode.class" />
1227
                                        <exclude name="**/D1NodeServiceTest.class" />
1228
                                        <exclude name="**/QueryRunner.class" />
1229
                                        <exclude name="**/MockObjectPathMap.class" />
1230
                                        <exclude name="**/HzObjectPathMapTest$1.class" />
1231
                                        <exclude name="**/HzObjectPathMapTest$2.class" />
1232
                                </fileset>
1233
                        </batchtest>
1234
                </junit>
1235
        </target>
1236

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

    
1240
                <echo>testtorun: ${testtorun}</echo>
1241

    
1242
                <!-- use the ant "junit" task to run JUnit tests. -->
1243
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1244
                        haltonerror="no" showoutput="yes">
1245
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1246
                        <classpath>
1247
                                <path refid="test.classpath" />
1248
                                <fileset dir="${build.dir}">
1249
                                        <include name="${name}.jar" />
1250
                                        <include name="${name}-client.jar" />
1251
                                        <include name="harvester.jar" />
1252
                                        <include name="${name}-junittests.jar" />
1253
                                </fileset>
1254
                        </classpath>
1255

    
1256
                        <formatter type="plain" />
1257

    
1258
                        <batchtest fork="yes" todir="${build.dir}">
1259
                                <fileset dir="${build.tests}">
1260
                                        <include name="**/${testtorun}.class" />
1261
                                </fileset>
1262
                        </batchtest>
1263
                </junit>
1264
        </target>
1265
        
1266
        <target name="run" depends="testprep"
1267
                        description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1268

    
1269
                        <echo>testtorun: ${testtorun}</echo>
1270

    
1271
                        <!-- use the ant "junit" task to run JUnit tests. -->
1272
                        <junit printsummary="yes" haltonfailure="no" fork="yes"
1273
                                haltonerror="no" showoutput="yes">
1274
                                <jvmarg value="-Dfile.encoding=UTF-8"/>
1275
                                <classpath>
1276
                                        <path refid="test.classpath" />
1277
                                        <fileset dir="${build.dir}">
1278
                                                <include name="${name}.jar" />
1279
                                                <include name="${name}-client.jar" />
1280
                                                <include name="harvester.jar" />
1281
                                                <include name="${name}-junittests.jar" />
1282
                                        </fileset>
1283
                                </classpath>
1284

    
1285
                                <formatter type="plain" />
1286

    
1287
                                <batchtest fork="yes" todir="${build.dir}">
1288
                                        <fileset dir="${build.tests}">
1289
                                                <include name="**/${testtorun}.class" />
1290
                                        </fileset>
1291
                                </batchtest>
1292
                        </junit>
1293
                </target>
1294

    
1295
        <target name="testharvester" depends="testprep"
1296
                description="Uses the ant junit task to test only the Harvester code">
1297
                <junit printsummary="yes" haltonfailure="off" fork="yes"
1298
                        haltonerror="off">
1299
                        <classpath>
1300
                                <path refid="compile.classpath" />
1301
                                <fileset dir="${build.dir}">
1302
                                        <include name="${name}.jar" />
1303
                                        <include name="${name}-client.jar" />
1304
                                        <include name="harvester.jar" />
1305
                                        <include name="${name}-junittests.jar" />
1306
                                </fileset>
1307
                        </classpath>
1308
                        <formatter type="plain" />
1309
                        <batchtest fork="yes" todir="${build.dir}">
1310
                                <fileset dir="${build.tests}">
1311
                                        <include name="**/harvesterClient/*.class" />
1312
                                </fileset>
1313
                        </batchtest>
1314
                </junit>
1315
        </target>
1316

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

    
1321
                <echo>
1322
                        *********************************** Please run ant
1323
                        gethttpclient first! ***********************************
1324
                </echo>
1325
                <!-- copy and compile the tests into a jar file -->
1326
                <mkdir dir="${build.metacatnettest}" />
1327
                <javac srcdir="${junitnettestsdir}"
1328
                        destdir="${build.metacatnettest}" includes="**/*.java">
1329
                        <classpath>
1330
                                <path refid="compile.classpath" />
1331
                                <fileset dir="${build.dir}">
1332
                                        <include name="${name}.jar" />
1333
                                </fileset>
1334
                        </classpath>
1335
                </javac>
1336

    
1337
                <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1338
                        basedir="${build.metacatnettest}" includes="**/*.class" />
1339

    
1340
                <!-- use the ant "junit" task to run JUnit tests. -->
1341
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1342
                        haltonerror="no">
1343
                        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1344
                        <classpath>
1345
                                <path refid="compile.classpath" />
1346
                                <fileset dir="${build.dir}">
1347
                                        <include name="${name}.jar" />
1348
                                        <include name="${name}-junitnettests.jar" />
1349
                                </fileset>
1350
                        </classpath>
1351

    
1352
                        <formatter type="plain" />
1353

    
1354
                        <batchtest fork="yes" todir="${build.dir}">
1355
                                <fileset dir="${build.metacatnettest}">
1356
                                        <include name="**/*.class" />
1357
                                </fileset>
1358
                        </batchtest>
1359
                </junit>
1360
        </target>
1361

    
1362
        <target name="cleanweb" depends="clean"
1363
                description="deletes tomcat web context dir and all its contents">
1364
                <delete dir="${installdir}" />
1365
        </target>
1366

    
1367

    
1368
        <target name="clean" depends="init"
1369
                description="deletes build dir and files that can be regenerated form the release">
1370
                <delete dir="${build.dir}" />
1371
                <delete dir="${dist.dir}" />
1372
        </target>
1373

    
1374
        <target name="localclean" depends="clean"
1375
                description="deletes even jars that depend on external sources such as stylesheets and jars">
1376
                <delete file="lib/utilities.jar" />
1377
        </target>
1378

    
1379
        <target name="fullclean" depends="localclean"
1380
                description="deletes code and eml">
1381
                <delete includeEmptyDirs="true" failonerror="false">
1382
                        <fileset dir="${style-common-cvsrelpath}">
1383
                                <include name="${eml-css}" />
1384
                                <include name="eml-*/*.xsl" />
1385
                                <include name="eml-*" />
1386
                        </fileset>
1387
                        <fileset dir="${schema-cvsrelpath}">
1388
                                <include name="eml-*/*.xsd" />
1389
                        </fileset>
1390
                        <fileset dir="${ecogrid-dir}"/>
1391
                        <fileset dir="lib/style/common/emlb6toeml2"/>
1392
                        <fileset dir="lib/dtd"/>
1393
                        <fileset dir="lib/schema"/>
1394
                        <fileset dir="${utilitiesdir}"/>
1395
                        <fileset dir="${metacatui.build.dir}"/>
1396
                        <fileset dir="${libdir.mvn}"/>
1397
                </delete>
1398
                <!-- clean up the distribution files if they exist-->
1399
                <delete file="./${name}-bin-${release}.tar.gz" />
1400
                <delete file="./${name}-src-${release}.tar.gz" />
1401
                <delete file="./${name}-bin-${release}.zip" />
1402
                <delete file="./${name}-src-${release}.zip" />
1403
        </target>
1404
        
1405
        <target name="documentation" depends="javadoc,admindoc"
1406
            description="generates Javadoc API documentation and Admin Guide">
1407
    </target>
1408
        
1409
        <target name="admindoc" depends="prepare">
1410
                <!-- Build the administrator's guide, which is a Sphinx RST project
1411
                     For this to succeed, you must have Sphinx installed on your machine
1412
                     See: http://sphinx.pocoo.org/ for details
1413
                     And you must also have the 'make' build tool installed
1414
                -->
1415
                <exec dir="${docdir}/user/metacat" executable="make"> 
1416
                        <arg value="plantuml"/> 
1417
                </exec>
1418
                
1419
                <exec dir="${docdir}/user/metacat" executable="make"> 
1420
                        <arg value="html"/> 
1421
                </exec>
1422
                
1423
    </target>
1424

    
1425
        <target name="javadoc" depends="prepare"
1426
                description="generates Javadoc API documentation">
1427
                <javadoc packagenames="edu.ucsb.nceas.*"
1428
                        sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1429
                        version="true" use="true" windowtitle="${Name} API"
1430
                        doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1431
                        bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1432
                        <classpath>
1433
                                <path refid="compile.classpath" />
1434
                        </classpath>
1435
                </javadoc>
1436
        </target>
1437

    
1438
        <target name="dist"
1439
                depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1440
                description="prepares a full release distribution">
1441
                <mkdir dir="${dist.dir}" />
1442
                <delete dir="${ver.dir}" />
1443
                <mkdir dir="${ver.dir}" />
1444
                <copy todir="${ver.dir}">
1445
                        <fileset dir="."
1446
                                excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1447
                </copy>
1448
                <copy todir="${ver.dir}" file="build.xml" />
1449
                <copy todir="${ver.dir}" file="build.properties" />
1450

    
1451
                <copy todir="${ver.dir}/docs" filtering="yes">
1452
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1453
                </copy>
1454
                <copy todir="${ver.dir}/docs" filtering="no">
1455
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1456
                </copy>
1457
                <copy todir="${ver.dir}/docs/dev">
1458
                        <fileset dir="${build.dir}/docs" />
1459
                </copy>
1460
                <copy todir="${ver.dir}/src">
1461
                        <fileset dir="${build.dir}/src" />
1462
                </copy>
1463

    
1464
                <mkdir dir="${ver.dir}/tests/servertestfiles" />
1465
                <copy todir="${ver.dir}/test/servertestfiles">
1466
                        <fileset dir="./test/servertestfiles" />
1467
                </copy>
1468
        </target>
1469

    
1470
        <target name="fulldist" depends="distbin, distsrc"
1471
                        description="full distribution - source and bin"/>
1472
                
1473
        <target name="distbin" depends="build-metacat,war-lsid"
1474
                description="prepares a binary distribution">
1475
                <copy todir="${dist.dir}">
1476
                        <fileset dir="./src/scripts" />
1477
                </copy>
1478
                <delete file="./${name}-bin-${release}.zip" />
1479
                <zip zipfile="./${name}-bin-${release}.zip"
1480
                        basedir="${dist.dir}" />
1481
                <delete file="./${name}-bin-${release}.tar.gz" />
1482
                <tar tarfile="./${name}-bin-${release}.tar"
1483
                        basedir="${dist.dir}" />
1484
                <gzip zipfile="./${name}-bin-${release}.tar.gz"
1485
                        src="./${name}-bin-${release}.tar" />
1486
                <delete file="./${name}-bin-${release}.tar" />
1487
        </target>
1488

    
1489
        <target name="distsrc" depends="dist"
1490
                description="prepares a source distribution">
1491
                <mkdir dir="${ver.src}" />
1492
                <copy todir="${ver.src}">
1493
                        <fileset dir="./src" />
1494
                </copy>
1495
                <mkdir dir="${util.dir}" />
1496
                <copy todir="${util.dir}">
1497
                        <fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1498
                </copy>
1499

    
1500
                <mkdir dir="${ecogrid-dist-dir}" />
1501
                <copy todir="${ecogrid-dist-dir}">
1502
                        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1503
                </copy>
1504

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

    
1507
                <delete file="./${name}-src-${release}.zip" />
1508
                <zip zipfile="./${name}-src-${release}.zip"
1509
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1510
                <delete file="./${name}-src-${release}.tar.gz" />
1511
                <tar tarfile="./${name}-src-${release}.tar"
1512
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1513
                <gzip zipfile="./${name}-src-${release}.tar.gz"
1514
                        src="./${name}-src-${release}.tar" />
1515
                <delete file="./${name}-src-${release}.tar" />
1516
                <!--delete dir="${dist.dir}"/ -->
1517
        </target>
1518

    
1519
        <target name="deb-package" depends="distbin"
1520
                description="create a debian installation package">
1521
                <delete dir="${deb.pkg.dir}" />
1522
                <mkdir dir="${deb.pkg.dir}/DEBIAN" />
1523
                <copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1524
                        <fileset dir="./src/scripts/debian"
1525
                                includes="control postinst" />
1526
                </copy>
1527

    
1528
                <mkdir
1529
                        dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1530
                <copy
1531
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1532
                        filtering="yes">
1533
                        <fileset dir="./src/scripts/debian"
1534
                                excludes="control postinst" />
1535
                </copy>
1536
                <chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1537

    
1538
                <copy file="${dist.dir}/${metacat.context}.war"
1539
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1540
                <copy file="./metacat-bin-${metacat.version}.tar.gz"
1541
                        tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1542

    
1543
                <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1544
                        failonerror="true">
1545
                        <arg line="--build debian" />
1546
                </exec>
1547

    
1548
                <move file="${pkg.dir}/debian.deb"
1549
                        tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1550
        </target>
1551

    
1552
        <target name="stylesheettest">
1553
                <xslt in="${input}" out="eml.html"
1554
                        style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1555
                        <param name="displaymodule" expression="${displaymodule}" />
1556
                        <param name="docid" expression="${input}" />
1557
                        <param name="entitytype" expression="${entitytype}" />
1558
                        <param name="entityindex" expression="${entityindex}" />
1559
                        <outputproperty name="method" value="html" />
1560
                        <outputproperty name="standalone" value="yes" />
1561
                        <outputproperty name="encoding" value="iso8859_1" />
1562
                        <outputproperty name="indent" value="yes" />
1563
                </xslt>
1564
        </target>
1565

    
1566
        <target name="spatial_option" depends="prepare"
1567
                description=" -- compiles code for the spatial option">
1568

    
1569
                <echo message="Compiling the metatcat shapefile creator" />
1570
                <echo message="using the shapelib at: ${shapelib.dir}" />
1571
                <exec dir="." executable="g++" os="Linux, Unix"
1572
                        failonerror="true">
1573
                        <arg
1574
                                line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1575
                </exec>
1576

    
1577
                <exec dir="." executable="g++" os="Linux, Unix"
1578
                        failonerror="true">
1579
                        <arg
1580
                                line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1581
                </exec>
1582
        </target>
1583

    
1584
        <!-- LSID Authority support -->
1585
        <patternset id="lsid.jars">
1586
                <include name="axis.jar" />
1587
                <include name="commons-discovery-0.2.jar" />
1588
                <include name="jaxrpc.jar" />
1589
                <include name="lsid-client-1.1.1.jar" />
1590
                <include name="lsid-server-1.1.1.jar" />
1591
                <include name="saaj.jar" />
1592
                <include name="wsdl4j-1.5.1.jar" />
1593
                <include name="activation.jar" />
1594
                <include name="castor-0.9.5.jar" />
1595
                <include name="dnsjava-1.3.2.jar" />
1596
                <include name="mail.jar" />
1597
                <include name="commons-logging-1.0.4.jar" />
1598
                <!-- These jars may be needed but seem to not actually be,
1599
                        so leaving them out for now
1600
                        <include name="axis-ant.jar" />
1601
                -->
1602
                <!--<include name="GenCastor.class" />-->
1603
        </patternset>
1604
        <patternset id="lib.jars">
1605
                <include name="log4j-1.2.12.jar" />
1606
                <include name="utilities.jar" />
1607
                <include name="xerces*.jar" />
1608
                <include name="xalan*.jar" />
1609
                <include name="xml-apis*.jar" />
1610
        </patternset>
1611

    
1612
        <path id="lsid.classpath">
1613
                <fileset dir="${lsid.lib.dir}">
1614
                        <patternset refid="lsid.jars" />
1615
                </fileset>
1616
                <fileset dir="${lib.dir}">
1617
                        <patternset refid="lib.jars" />
1618
                </fileset>
1619
                <fileset dir="${build.dir}">
1620
                        <include name="metacat-client.jar" />
1621
                        <include name="metacat.jar" />
1622
                </fileset>
1623
        </path>
1624

    
1625
        <filterset id="configFilters">
1626
                <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1627
                        value="${config.hostname}" / -->
1628
                <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1629
                        value="${config.port}" / -->
1630
                <!-- MCD BYE filter token="METADATA_LABELS"
1631
                        value="${config.metadataLabelLsid}" / -->
1632
                <!-- MCD BYE filter token="METACAT_SERVER"
1633
                        value="${config.metacatserver}" / -->
1634
                <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1635
                        value="${config.lsidauthority}" / -->
1636
        </filterset>
1637

    
1638
        <target name="prepare-lsid" depends="prepare,utilities,clientjar"
1639
                description="Configure files prior to compilation">
1640
                <mkdir dir="${lsid.build.dir}" />
1641
                <!-- Copy the properties file into the build -->
1642
                <copy file="${conf.dir}/metacat-lsid.properties"
1643
                        tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1644
                        overwrite="true">
1645
                        <filterset refid="configFilters" />
1646
                </copy>
1647
                <copy file="${conf.dir}/log4j.properties"
1648
                        tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1649
                        overwrite="true">
1650
                        <filterset refid="configFilters" />
1651
                </copy>
1652
                <!-- Copy config files into the build -->
1653
                <copy todir="${lsid.build.dir}/WEB-INF">
1654
                        <fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1655
                </copy>
1656
                <!-- Copy the metadata configuration files into the build -->
1657
                <mkdir
1658
                        dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1659
                <copy
1660
                        todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1661
                        <fileset dir="${conf.dir}" includes="**/*.xml" />
1662
                        <fileset dir="${conf.dir}" includes="**/*.xslt" />
1663
                        <filterset refid="configFilters" />
1664
                </copy>
1665
                <!-- Copy services files into the build -->
1666
                <mkdir dir="${lsid.build.dir}/services" />
1667
                <copy todir="${lsid.build.dir}/services">
1668
                        <fileset dir="${services.dir}" />
1669
                        <filterset refid="configFilters" />
1670
                </copy>
1671
                <!-- Copy axis files into the build -->
1672
                <mkdir dir="${lsid.build.dir}" />
1673
                <copy todir="${lsid.build.dir}">
1674
                        <fileset dir="${conf.dir}/axis" excludes="*.properties" />
1675
                </copy>
1676
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1677
                <copy todir="${lsid.build.dir}/WEB-INF/classes">
1678
                        <fileset dir="${conf.dir}/axis" includes="*.properties" />
1679
                </copy>
1680
        </target>
1681

    
1682
        <target name="compile-lsid" depends="prepare-lsid"
1683
                description="Compile Java sources">
1684
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1685
                <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1686
                        destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1687
                        deprecation="${compile.deprecation}"
1688
                        optimize="${compile.optimize}">
1689
                        <classpath>
1690
                                <path refid="compile.classpath" />
1691
                                <fileset dir="${build.dir}">
1692
                                        <include name="${name}.jar" />
1693
                                </fileset>
1694
                        </classpath>
1695
                </javac>
1696
        </target>
1697

    
1698
        <target name="war-lsid" depends="compile-lsid"
1699
                description="Create a war file for the application">
1700
                <mkdir dir="${dist.dir}" />
1701
                <war destfile="${dist.dir}/${authority.context}.war"
1702
                        webxml="${webinf.dir}/web.xml">
1703
                        <fileset dir="${lsid.build.dir}" />
1704
                        <lib dir="${lsid.lib.dir}">
1705
                                <patternset refid="lsid.jars" />
1706
                        </lib>
1707
                        <lib dir="${lib.dir}">
1708
                                <patternset refid="lib.jars" />
1709
                        </lib>
1710
                        <lib dir="${lib.dir}">
1711
                                <include name="xalan.jar" />
1712
                                <include name="xml-apis.jar" />
1713
                        </lib>
1714
                        <lib dir="${build.dir}">
1715
                                <include name="metacat-client.jar" />
1716
                        </lib>
1717
                </war>
1718
        </target>
1719

    
1720
        <target name="deploy-lsid" depends="war-lsid"
1721
                description="Deploy LSID war to servlet container">
1722
                <delete dir="${app.deploy.dir}/${authority.context}" />
1723
                <delete file="${app.deploy.dir}/${authority.context}.war" />
1724
                <mkdir dir="${app.deploy.dir}" />
1725
                <copy todir="${app.deploy.dir}">
1726
                        <fileset dir="${dist.dir}" />
1727
                </copy>
1728
        </target>
1729
        
1730
        <target name="change-metacat-properties" depends="warPrepare"
1731
        description="Chage some default values of metacat.properties">
1732
       <echo file="${metacat-properties-file}" append="true">
1733
                   configutil.propertiesConfigured=true
1734
                   configutil.authConfigured=true
1735
           configutil.skinsConfigured=true
1736
                   configutil.databaseConfigured=true
1737
                   configutil.geoserverConfigured=true
1738
           </echo>
1739
  </target>
1740
        
1741
        <!-- This target will use default values in svn metacat.properties to build a configured 
1742
                metacat (except configuti.* properties, they will be set true). Those default settings
1743
                are for a test machine. It may not work on your system-->
1744
        <target name="install-configured-metacat" depends="change-metacat-properties, install"
1745
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1746
    </target>
1747
        
1748
        <!-- build metacat-common jar -->
1749
        <target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1750
                <artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1751
                            <arg value="clean"/>
1752
                </artifact:mvn>
1753
                <artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1754
                   <arg value="install"/>
1755
                </artifact:mvn>
1756
                <property name="build-metacat-common-called" value="true"/>
1757
        </target>
1758

    
1759
        <!-- build metacat-index war -->
1760
        <target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >                
1761
                <artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1762
                        <arg value="clean"/>
1763
                </artifact:mvn>
1764
                <artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1765
                        <arg value="package"/>
1766
                        <!--<arg value="-Dmaven.test.skip=true"/>-->
1767
                </artifact:mvn>
1768
        </target>
1769
        
1770
        <target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >                
1771
                <copy tofile="${dist.dir}/metacat-index.war" >
1772
                        <fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1773
                </copy>        
1774
        </target>
1775
        
1776
        <target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >                
1777
                <copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1778
        </target>
1779
        
1780
</project>