Project

General

Profile

metacat / build.xml @ 8242

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-18 15:50:21 -0700 (Wed, 18 Sep 2013) $'
11
        *    '$Revision: 8242 $'
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="* Full Install For Development *">
832
                <copy file="${dist.dir}/${metacat.context}.war"
833
                        todir="${app.deploy.dir}" />
834
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
835
                        todir="${app.deploy.dir2}" />-->
836
                <delete dir="${app.deploy.dir}/${metacat.context}" />
837
                <!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
838
                <copy file="${dist.dir}/geoserver.war"
839
                                        todir="${app.deploy.dir}" />
840
                <copy file="${dist.dir}/metacat-index.war"
841
                                        todir="${app.deploy.dir}" />
842
                <tstamp>
843
                        <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
844
                </tstamp>
845
                <echo>Dev install completed at ${NOW}</echo>
846
        </target>
847

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

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

    
873

    
874
        </target>
875

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

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

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

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

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

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

    
950
                <echo message="Install Skin completed." />
951
        </target>
952

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1216
                        <formatter type="plain" />
1217

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

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

    
1238
                <echo>testtorun: ${testtorun}</echo>
1239

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

    
1254
                        <formatter type="plain" />
1255

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

    
1267
                        <echo>testtorun: ${testtorun}</echo>
1268

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

    
1283
                                <formatter type="plain" />
1284

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

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

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

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

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

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

    
1350
                        <formatter type="plain" />
1351

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

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

    
1365

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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