Project

General

Profile

metacat / build.xml @ 9782

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: 2016-05-18 09:45:29 -0700 (Wed, 18 May 2016) $'
11
        *    '$Revision: 9782 $'
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
        <property name="java.target.version" value="1.7" /> <!-- the target version for java compilation-->
37
        <property name="java.source.version" value="1.7" /> <!-- the source code version for java compilation-->
38

    
39
    <!-- Configure the maven2 ant tasks -->
40
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
41
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
42
             uri="antlib:org.apache.maven.artifact.ant"
43
             classpathref="maven-ant-tasks.classpath" />
44
        
45
        <!-- defining the axis tasks -->
46
        <path id="axis.ant.classpath">
47
                <fileset dir="lib/lsid_lib">
48
                        <include name="*.jar" />
49
                </fileset>
50
        </path>
51
        
52
        <!-- Allow integration with Git projects -->
53
        <macrodef name = "git">
54
            <attribute name = "command" />
55
            <attribute name = "dir" default = "" />
56
            <element name = "args" optional = "true" />
57
            <sequential>
58
                <echo message = "git @{command}" />
59
                <exec executable = "git" dir = "@{dir}">
60
                    <arg value = "@{command}" />
61
                    <args/>
62
                </exec>
63
            </sequential>
64
        </macrodef>
65
        <macrodef name = "git-clone-pull">
66
            <attribute name = "repository" />
67
            <attribute name = "dest" />
68
            <attribute name = "refname" />
69
            <sequential>
70
                <git command = "clone">
71
                    <args>
72
                        <arg value = "@{repository}" />
73
                        <arg value = "@{dest}" />
74
                    </args>
75
                </git>
76
                <git command = "checkout" dir = "@{dest}">
77
                        <args>
78
                        <arg value = "@{refname}" />
79
                    </args>
80
                </git>
81
                    <git command = "pull" dir = "@{dest}" >
82
                        <args>
83
                        <arg value = "@{repository}" />
84
                        <arg value = "@{refname}" />
85
                    </args>
86
                </git>
87
            </sequential>
88
        </macrodef>
89
        
90
        <!-- get metacatUI project -->
91
        <target name="getMetacatUI" depends="init">
92
                <git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" refname="${metacatui.git.repository.refname}" />
93
        </target>
94
        
95
        <target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" unless="build-metacat-ui-called">
96
                <artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
97
                        <arg value="clean"/>
98
                </artifact:mvn>
99
                <artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
100
                   <arg value="package"/>
101
                </artifact:mvn>
102
                <property name="build-metacat-ui-called" value="true"/>
103
        </target>
104
        
105
        <target name="dist-metacat-ui" depends="build-metacat-ui">
106
                <copy tofile="${dist.dir}/metacatui.war" >
107
                        <fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
108
                </copy>        
109
        </target>
110
            
111
        <taskdef resource="axis-tasks.properties"
112
                classpathref="axis.ant.classpath" />
113
        
114
        <!-- Determine if ecogrid should be installed-->
115
        <condition property="enable.ecogrid">
116
                <equals arg1="${install.ecogrid}" arg2="true" />
117
        </condition>
118

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

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

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

    
142
                <property name="debug" value="on" />
143
                <property name="morphosourcedir" value="../morpho" />
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="seek-tag" value="tags/ECOGRID_1_2_3" />
234
                <property name="eml-module" value="eml" />
235
                <property name="eml-version" value="2.0.0beta6" />
236
                <property name="eml-beta4-version" value="2.0.0beta4" />
237
                <property name="eml-beta-tag"
238
                        value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
239
                <property name="eml-beta4-tag"
240
                                        value="RELEASE_EML_2_BETA_4" />
241
                <property name="eml2_0_0-schema-tag"
242
                        value="RELEASE_EML_2_0_0_UPDATE_1" />
243
                <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
244
                <property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
245
                <property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
246
                <!--<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />-->
247
                <property name="eml2-style-tag" value="trunk" />
248

    
249
                <property name="eml2_0_0namespace"
250
                        value="eml://ecoinformatics.org/eml-2.0.0" />
251
                <property name="eml2_0_1namespace"
252
                        value="eml://ecoinformatics.org/eml-2.0.1" />
253
                <property name="eml2_1_0namespace"
254
                        value="eml://ecoinformatics.org/eml-2.1.0" />
255
                <property name="eml2_1_1namespace"
256
                        value="eml://ecoinformatics.org/eml-2.1.1" />
257
                <property name="stmmlnamespace"
258
                        value="http://www.xml-cml.org/schema/stmml" />
259
                <property name="stmml11namespace"
260
                        value="http://www.xml-cml.org/schema/stmml-1.1" />
261
                <property name="eml-css" value="eml_xsl.css" />
262
                <property name="eml-module.default.css" value="default.css" />
263
                <property name="systemidserver" value="" />
264
                <property name="html-path" value="" />
265
                <property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
266

    
267

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

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

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

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

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

    
336

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

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

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

    
385
                <property name="package.home" value="edu/ucsb/nceas/metacat" />
386

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

    
432
                <condition property="eml.required">
433
                        <or>
434
                                <not>
435
                                        <available file="lib/schema/eml-2.0.1/eml.xsd" />
436
                                </not>
437
                                <not>
438
                                        <available file="lib/schema/eml-2.0.0/eml.xsd" />
439
                                </not>
440
                                <not>
441
                                        <available file="lib/schema/eml-2.1.0/eml.xsd" />
442
                                </not>
443
                                <not>
444
                                        <available
445
                                                file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
446
                                </not>
447
                        </or>
448
                </condition>
449

    
450
                <condition property="ecogrid.required">
451
                        <or>
452
                                <not>
453
                                        <available file="${ecogrid-dir}/build.properties" />
454
                                </not>
455
                                <not>
456
                                        <available
457
                                                file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
458
                                </not>
459
                        </or>
460
                </condition>
461
                
462
                <property name="init.called" value="true" />
463

    
464
        </target>
465
        
466
        <target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
467
                        <echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
468
                        <!-- Clear out mvn dir -->
469
                        <delete dir="${libdir.mvn}"></delete>
470
                        <!-- Copy all dependencies to the correct location. -->
471
                        <copy todir="${libdir.mvn}">
472
                                <fileset refid="dependency.fileset" />
473
                                <!-- This mapper strips off all leading directory information -->
474
                                <mapper type="flatten" />
475
                        </copy>
476
                </target>
477

    
478
        <target name="prepare" depends="init, resolveDependencies">
479
                <mkdir dir="${build.dir}" />
480
                <mkdir dir="${build.src}" />
481
                <mkdir dir="${build.dest}" />
482
                <mkdir dir="${build.docs}" />
483
                <mkdir dir="${build.javadocs}" />
484
                <mkdir dir="${build.tmp}" />
485

    
486
                <copy todir="${build.src}" filtering="yes">
487
                        <fileset dir="${srcdir}">
488
                                <include name="edu/**" />
489
                                <include name="com/**" />
490
                                <include name="org/**" />
491
                                <!-- include name="java/**" / -->
492
                                <include name="**/*.sql" />
493
                                <exclude name="**/CVS*" />
494
                                <exclude name="**/.#*" />
495
                                <exclude name="edu/ucsb/nceas/workflowscheduler/**" />
496
                        </fileset>
497
                </copy>
498
                <available file="lib/style/common/emlb6toeml2" type="dir"
499
                        property="styles.not.needed" />
500
        </target>
501

    
502
        <target name="generateStubs" depends="prepare">
503
                <echo
504
                        message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
505
                <axis-wsdl2java verbose="true" output="${srcdir}"
506
                        url="/tmp/KeplerWebService.wsdl" />
507
        </target>
508

    
509
        <target name="compile" depends="prepare"
510
                description="Compiles java code to build dir, and copies metacat props files there">
511

    
512
                <javac srcdir="${build.src}" destdir="${build.dest}"
513
                        target="${java.target.version}"
514
                        source="${java.source.version}"
515
                        debug="${debug}"
516
                        excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
517
                        <classpath>
518
                                <path refid="compile.classpath" />
519
                        </classpath>
520
                </javac>
521
        </target>
522

    
523
        <target name="jar" depends="compile,geteml"
524
                description="Compiles and jars metacat java code to metacat.jar in build dir ">
525

    
526
                <delete file="${build.dir}/${name}.jar" />
527
                <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
528
                        excludes="**/protocols/ **/harvesterClient/" />
529
        </target>
530

    
531
        <target name="protocol" depends="compile"
532
                description="Compiles and jars protocol java code to protocol.jar in build dir">
533
                <delete file="${build.dir}/protocol.jar" />
534
                <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
535
                        includes="**/protocols/" />
536
        </target>
537

    
538

    
539
        <target name="client" depends="prepare"
540
                description="Compiles metacat-client java code to build dir">
541
                <javac srcdir="${build.src}" destdir="${build.dest}"
542
                        target="${java.target.version}"
543
                        source="${java.source.version}"
544
                        includes="edu/ucsb/nceas/metacat/client/*">
545
                        <classpath>
546
                                <path refid="compile.classpath" />
547
                        </classpath>
548
                </javac>
549
        </target>
550

    
551
        <target name="clientjar" depends="client"
552
                description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
553
                <delete file="${build.dir}/${name}-client.jar" />
554
                <jar jarfile="${build.dir}/${name}-client.jar"
555
                        basedir="${build.dest}" includes="**/metacat/client/" />
556
        </target>
557

    
558
        <target name="advancedsearchjar" depends="compile"
559
                description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
560
                <delete file="${build.dir}/advancedsearch.jar" />
561
                <jar jarfile="${build.dir}/advancedsearch.jar"
562
                        basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
563
        </target>
564

    
565
        <target name="harvester" depends="client"
566
                description="Compiles harvester java code to build dir">
567
                <javac srcdir="${build.src}" destdir="${build.dest}"
568
                        target="${java.target.version}"
569
                        source="${java.source.version}"
570
                        includes="edu/ucsb/nceas/metacat/harvesterClient/*">
571
                        <classpath>
572
                                <path refid="compile.classpath" />
573
                        </classpath>
574
                </javac>
575
        </target>
576
                
577
        <target name="harvesterjar" depends="harvester"
578
                description="Compiles and jars harvester java code to harvester.jar in build dir">
579
                <delete file="${build.dir}/harvester.jar" />
580
                <jar jarfile="${build.dir}/harvester.jar"
581
                        basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
582
        </target>
583

    
584
        <target name="harvestListEditorDist" depends="harvesterjar"
585
                description="Prepares a distribution of the Harvest List Editor tool">
586
                <mkdir dir="${dist.dir.hle}" />
587
                <delete dir="${ver.dir.hle}" />
588
                <mkdir dir="${ver.dir.hle}" />
589
                <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
590
                <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
591
                <copy todir="${ver.dir.hle}"
592
                        file="lib/harvester/harvestList.xsd" />
593
                <copy todir="${ver.dir.hle}"
594
                        file="lib/harvester/harvestListEditor.bat" />
595
                <copy todir="${ver.dir.hle}"
596
                        file="lib/harvester/harvestListEditor.sh" />
597
                <delete file="./harvest-list-editor-${release}.zip" />
598
                <zip zipfile="./harvest-list-editor-${release}.zip"
599
                        basedir="${ver.dir.hle}" />
600
                <delete file="./harvest-list-editor-${release}.tar.gz" />
601
                <tar tarfile="./harvest-list-editor-${release}.tar"
602
                        basedir="${ver.dir.hle}" />
603
                <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
604
                        src="./harvest-list-editor-${release}.tar" />
605
                <delete file="./harvest-list-editor-${release}.tar" />
606
        </target>
607

    
608
        <target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
609
                if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
610

    
611
        <target name="getemlpre2" depends="prepare" if="eml.required"
612
                description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
613
                <svn>
614
                        <export srcUrl="${svn.emlBetaUrl}"
615
                                destPath="${build.tmp}/eml_${eml-beta-tag}" />
616
                </svn>
617
                <mkdir dir="lib/dtd" />
618
                <copy todir="lib/dtd" filtering="yes">
619
                        <fileset
620
                                dir="${build.tmp}/eml_${eml-beta-tag}">
621
                                <include name="*.dtd" />
622
                        </fileset>
623
                        <mapper type="glob" from="eml-*.dtd"
624
                                to="eml-*-${eml-version}.dtd" />
625
                </copy>
626

    
627
                <copy todir="${style-common-cvsrelpath}" filtering="yes">
628
                        <fileset
629
                                dir="${build.tmp}/eml_${eml-beta-tag}/style">
630
                                <include name="**/*.xsl" />
631
                        </fileset>
632
                </copy>
633
        </target>
634
        
635
        <target name="getemlpre2beta4" depends="prepare" if="eml.required"
636
                        description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
637
                        <svn>
638
                                <export srcUrl="${svn.emlBeta4Url}"
639
                                        destPath="${build.tmp}/eml_${eml-beta4-tag}" />
640
                        </svn>
641
                        <mkdir dir="lib/dtd" />
642
                        <copy todir="lib/dtd" filtering="yes">
643
                                <fileset
644
                                        dir="${build.tmp}/eml_${eml-beta4-tag}">
645
                                        <include name="*.dtd" />
646
                                </fileset>
647
                                <mapper type="glob" from="eml-*.dtd"
648
                                        to="eml-*-${eml-beta4-version}.dtd" />
649
                        </copy>
650

    
651
                        <!--
652
                        <copy todir="${style-common-cvsrelpath}" filtering="yes">
653
                                <fileset
654
                                        dir="${build.tmp}/eml_${eml-beta4-tag}/style">
655
                                        <include name="**/*.xsl" />
656
                                </fileset>
657
                        </copy>
658
                        -->
659
                </target>
660

    
661
        <target name="geteml2+" depends="prepare" if="eml.required"
662
                description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
663
                <svn>
664
                        <export srcUrl="${svn.eml200SchemaUrl}"
665
                                destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
666
                </svn>
667
                <mkdir dir="lib/schema/eml-2.0.0" />
668
                <copy todir="lib/schema/eml-2.0.0" filtering="yes">
669
                        <fileset
670
                                dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
671
                                <include name="*.xsd" />
672
                        </fileset>
673

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

    
680
                </copy>
681
                <!-- <antcall target="copyxsl">
682
                        <param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
683
                        <param name="dirname" value="eml-2.0.0" />
684
                        </antcall> -->
685

    
686
                <!-- Checkout eml201 for given schema tag-->
687
                <svn>
688
                        <export srcUrl="${svn.eml201SchemaUrl}"
689
                                destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
690
                </svn>
691
                <mkdir dir="lib/schema/eml-2.0.1" />
692
                <copy todir="lib/schema/eml-2.0.1" filtering="yes">
693
                        <fileset
694
                                dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
695
                                <include name="*.xsd" />
696
                        </fileset>
697
                </copy>
698

    
699
                <!-- Checkout eml201 again for given style sheet tag-->
700
                <!-- echo>Enter CVS password: </echo>
701
                        <cvs cvsRoot="${cvsroot}"
702
                        package="${eml-module}"
703
                        tag="${eml2_0_1-style-tag}"
704
                        dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
705
                        <antcall target="copyxsl">
706
                        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
707
                        <param name="dirname" value="eml-2.0.1" />
708
                        </antcall -->
709

    
710
                <!-- Checkout eml210 for given schema tag-->
711
                <svn>
712
                        <export srcUrl="${svn.eml210SchemaUrl}"
713
                                destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
714
                </svn>
715
                <mkdir dir="lib/schema/eml-2.1.0" />
716
                <copy todir="lib/schema/eml-2.1.0" filtering="yes">
717
                        <fileset
718
                                dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
719
                                <include name="*.xsd" />
720
                        </fileset>
721
                </copy>
722

    
723
                <!-- Checkout eml210 for given style sheet tag-->
724
                <svn>
725
                        <export srcUrl="${svn.eml2StyleUrl}"
726
                                destPath="${build.tmp}/eml_${eml2-style-tag}" />
727
                </svn>
728
                <antcall target="copyxsl">
729
                        <param name="cvs.tagname" value="${eml2-style-tag}" />
730
                        <!-- param name="dirname" value="eml-2.1.0" / -->
731
                        <param name="dirname" value="eml-2" />
732
                </antcall>
733
                
734
                <!-- Checkout eml210 for given schema tag-->
735
                <svn>
736
                        <export srcUrl="${svn.eml211SchemaUrl}"
737
                                destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
738
                </svn>
739
                <mkdir dir="lib/schema/eml-2.1.1" />
740
                <copy todir="lib/schema/eml-2.1.1" filtering="yes">
741
                        <fileset
742
                                dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
743
                                <include name="*.xsd" />
744
                        </fileset>
745
                </copy>
746
        </target>
747

    
748
        <target name="copyxsl"
749
                description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
750

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

    
753
                <copy todir="${style-common-cvsrelpath}/${dirname}"
754
                        filtering="yes">
755
                        <fileset
756
                                dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
757
                                <include name="**/*.xsl" />
758
                        </fileset>
759
                </copy>
760

    
761

    
762
                <!-- now copy default css from eml module and put it in style-common-path
763
                        dir with a new name, so other skin-specific css can import it if reqd -->
764
                <copy
765
                        file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
766
                        tofile="${style-common-cvsrelpath}/${eml-css}" />
767

    
768
        </target>
769

    
770
        <target name="correctEML201Docs" depends="jar"
771
                description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
772
                <copy todir="${build.dir}" file="lib/metacat.properties"
773
                        filtering="yes" />
774
                <java
775
                        classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
776
                        <classpath>
777
                                <path refid="compile.classpath" />
778
                                <fileset dir="${build.dir}">
779
                                        <include name="${name}.jar" />
780
                                </fileset>
781
                        </classpath>
782
                </java>
783
        </target>
784

    
785
        <target name="install-spatial" depends="jar,clientjar,harvesterjar"
786
                description="Installs spatial option for metacat">
787
                
788
                <copy todir="${dist.dir}">
789
                        <fileset dir="./lib/spatial/geoserver" includes="*.war" />
790
                </copy>
791

    
792
        </target>
793

    
794
        <target name="install" depends="build-metacat"
795
                description="* Install Metacat For Development *">
796
                <copy file="${dist.dir}/${metacat.context}.war"
797
                        todir="${app.deploy.dir}" />
798
                <delete dir="${app.deploy.dir}/${metacat.context}" />
799
                <copy file="${dist.dir}/geoserver.war"
800
                                        todir="${app.deploy.dir}" />
801
                <delete dir="${app.deploy.dir}/geoserver" />
802
                <copy file="${dist.dir}/metacat-index.war"
803
                                        todir="${app.deploy.dir}" />
804
                <delete dir="${app.deploy.dir}/metacat-index" />
805
                <copy file="${dist.dir}/metacatui.war"
806
                                        todir="${app.deploy.dir}" />
807
                <delete dir="${app.deploy.dir}/metacatui" />
808
                <tstamp>
809
                        <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
810
                </tstamp>
811
                <echo>Dev install completed at ${NOW}</echo>
812
        </target>
813

    
814
        <target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
815
                description="Build Metacat">
816
        </target>
817

    
818
        <target name="install-ecogrid" depends="warPrepare, get-ecogrid"
819
                if="enable.ecogrid" description="Install Ecogrid Compentent">
820
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
821
                        inheritall="false">
822
                        <property name="context" value="${metacat.context}" />
823
                        <property name="target" value="${ecogrid-target-name}" />
824
                </ant>
825
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
826
                        inheritall="false">
827
                        <property name="context" value="${metacat.context}" />
828
                        <property name="target" value="${ecogrid-target-name}" />
829
                        <property name="metacat.dir" value="${basedir}"/>
830
                </ant>
831
                <!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
832
                        <webinf dir="${ecogrid-dir}/lib">
833
                        <include name="server-config.wsdd"/>
834
                        </webinf>
835
                        </war -->
836
                <copy file="${ecogrid-dir}/build/${metacat.context}.war"
837
                        todir="${dist.dir}" overwrite="true" />
838

    
839

    
840
        </target>
841

    
842
        <target name="get-ecogrid" depends="init"
843
                description="Check out ecogrid module" if="ecogrid.required">
844
                <svn>
845
                        <export srcUrl="${svn.ecogridUrl}" force="true"
846
                                destPath="${ecogrid-dir}" />
847
                </svn>
848
        </target>
849

    
850
        <!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
851
                <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
852
                <property name="context" value="${metacat.context}"/>
853
                <property name="target" value="${ecogrid-target-name}"/>
854
                <property name="metacat.dir" value="."/>
855
                <property name="hostname" value="${ecogrid.hostname}"/>
856
                <property name="port" value="${config.port}"/>
857
                </ant>
858
                </target -->
859

    
860
        <target name="clean-ecogrid-server-config-wsdd" depends="init"
861
                description="Automately generate wsdd for ecogrid service">
862
                <delete
863
                        file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
864
        </target>
865

    
866
        <target name="install-skin" depends="init"
867
                description="Install a Skin">
868

    
869
                <input message="Please enter name of the skin"
870
                        addproperty="skin-name" />
871

    
872
                <mkdir dir="${installdir}/style/skins/${skin-name}" />
873
                <copy todir="${installdir}/style/skins/${skin-name}"
874
                        filtering="yes">
875
                        <fileset dir="lib/style/skins/${skin-name}">
876
                                <exclude name="**/*.png" />
877
                                <exclude name="**/*.gif" />
878
                                <exclude name="**/*.jpg" />
879
                                <exclude name="**/CVS*" />
880
                                <exclude name="**/.#*" />
881
                        </fileset>
882
                </copy>
883
                <copy todir="${installdir}/style/skins/${skin-name}"
884
                        filtering="no">
885
                        <fileset dir="lib/style/skins/${skin-name}">
886
                                <include name="**/*.png" />
887
                                <include name="**/*.gif" />
888
                                <include name="**/*.jpg" />
889
                                <exclude name="**/CVS*" />
890
                                <exclude name="**/.#*" />
891
                        </fileset>
892
                </copy>
893
                <copy todir="${installdir}/style/common" filtering="yes">
894
                        <fileset dir="lib/style/common">
895
                                <include name="*.js" />
896
                                <include name="*.jsp" />
897
                                <include name="*.css" />
898
                                <exclude name="*.png" />
899
                                <exclude name="*.gif" />
900
                                <exclude name="*.jpg" />
901
                                <exclude name="**/CVS*" />
902
                                <exclude name="**/.#*" />
903
                        </fileset>
904
                </copy>
905
                <!--
906
                        <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
907
                        <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
908
                        <fileset dir="lib/style/skins/${skin-name}/images">
909
                        <include name="*.png"/>
910
                        <include name="*.gif"/>
911
                        <include name="*.jpg"/>
912
                        </fileset>
913
                        </copy>
914
                -->
915

    
916
                <echo message="Install Skin completed." />
917
        </target>
918

    
919
        <target name="war" depends="warPrepare,install-spatial"
920
                description="Create a web archive (WAR) for servlet deployment">
921
                <mkdir dir="${dist.dir}" />
922
                <war destfile="${dist.dir}/${metacat.context}.war"
923
                        webxml="${build.war}/web.xml">
924
                        <fileset dir="${war.context}" />
925
                        <lib dir="${war.lib}" />
926
                        <webinf dir="${war.webinf}" />
927
                </war>
928
        </target>
929

    
930
        <target name="warPrepare"
931
                depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
932
                description="Prepare files for creating a web archive (WAR)">
933

    
934
                <property name="war.lib" value="${build.war}/lib" />
935
                <property name="war.webinf" value="${build.war}/WEB-INF" />
936
                <property name="war.context"
937
                        value="${build.war}/${metacat.context}" />
938
                <property name="war.webinf.sql" value="${war.webinf}/sql" />
939
                <property name="war.webinf.scripts"
940
                        value="${war.webinf}/scripts" />
941
                <property name="war.context.cgi" value="${war.context}/cgi-bin" />
942
                <property name="war.context.docs" value="${war.context}/docs" />
943
                <property name="war.context.temp" value="${war.context}/temp" />
944
                <property name="war.context.templates"
945
                        value="${war.context}${style-common-relpath}/templates" />
946
                <mkdir dir="${war.lib}" />
947
                <mkdir dir="${war.webinf}" />
948
                <mkdir dir="${war.context}" />
949
                <mkdir dir="${war.webinf.sql}" />
950
                <mkdir dir="${war.context.cgi}" />
951
                <mkdir dir="${war.context.docs}" />
952
                <mkdir dir="${war.context.temp}" />
953
                <mkdir dir="${war.context.templates}" />
954

    
955
                <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
956
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
957
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
958
                <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
959
                <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
960
                <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
961
                <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
962
                <copy todir="${war.lib}" filtering="no">
963
                        <fileset dir="lib">
964
                                <include name="*.jar" />
965
                                <exclude name="maven-ant-tasks*.jar" />
966
                        </fileset>
967
                        <fileset dir="${libdir.mvn}" />                        
968
                </copy>
969
                <!-- MCD copy file="lib/web.xml.${tomcatversion}"
970
                        tofile="${build.war}/web.xml" / -->
971
                <!-- MCD added next - Remove the tomcat5 reference-->
972
                <copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
973
                <copy file="lib/metacat.properties" todir="${war.webinf}"
974
                        filtering="yes" />
975
                <copy todir="${war.webinf}" filtering="yes">
976
                    <fileset dir="lib/account-web-info">
977
                       <exclude name="web.xml" />
978
                    </fileset>
979
                </copy>
980
                <copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
981
                <copy file="lib/metacat.properties.metadata.xml"
982
                        todir="${war.webinf}" filtering="no" />
983
                <copy file="lib/org.properties.metadata.xml"
984
                        todir="${war.webinf}" filtering="no" />
985
                <copy file="lib/auth.properties.metadata.xml"
986
                        todir="${war.webinf}" filtering="no" />
987
                <copy todir="${war.webinf}" filtering="yes">
988
                        <fileset dir="lib">
989
                                <include name="skin.configs/**" />
990
                        </fileset>
991
                </copy>
992
                <copy file="lib/log4j.properties" todir="${war.webinf}"
993
                        filtering="yes" /> 
994
                <copy file="lib/hazelcast.xml" todir="${war.webinf}"
995
                        filtering="yes" />
996
                <!--<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
997
                        filtering="yes" /> -->
998
                <copy todir="${war.context}" filtering="no">
999
                        <fileset dir="lib">
1000
                                <include name="**/*.jpg" />
1001
                                <include name="**/*.png" />
1002
                                <include name="**/*.gif" />
1003
                                <include name="LiveMap_30/**" />
1004
                                <include name="oaipmh/**" />
1005
                        </fileset>
1006
                </copy>
1007
                <copy todir="${war.context}" filtering="yes">
1008
                        <fileset dir="lib">
1009
                                <exclude name="*.jar" />
1010
                                <exclude name="*.properties" />
1011
                                <exclude name="*.metadata.xml" />
1012
                                <exclude name="web.xml" />
1013
                                <exclude name="**/*.jpg" />
1014
                                <exclude name="**/*.png" />
1015
                                <exclude name="**/*.gif" />
1016
                                <exclude name="lsid_lib/**" />
1017
                                <exclude name="lsid_conf/**" />
1018
                                <exclude name="LiveMap_30/**" />
1019
                                <exclude name="oaipmh/**" />
1020
                                <exclude name="maven/**" />
1021
                                <exclude name="skin.configs/**" />
1022
                                <exclude name="spatial/geoserver/**" />
1023
                        </fileset>
1024
                </copy>
1025
                <copy todir="${war.context}" filtering="no">
1026
                        <fileset dir="lib">
1027
                                <include name="spatial/geoserver/data/**" />
1028
                        </fileset>
1029
                </copy>
1030
                <copy todir="${war.context.docs}" filtering="no">
1031
                        <fileset dir="${build.docs}" />
1032
                </copy>
1033
                <copy todir="${war.webinf.sql}" filtering="yes">
1034
                        <fileset dir="src">
1035
                                <include name="**/*.sql" />
1036
                        </fileset>
1037
                </copy>
1038
                <copy todir="${war.webinf.scripts}" filtering="yes">
1039
                        <fileset dir="src/scripts" />
1040
                </copy>
1041
                <copy todir="${war.webinf.scripts}"
1042
                        file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1043
                        failonerror="false" />
1044

    
1045
                <copy file="src/perl/register-dataset.cgi"
1046
                        todir="${war.context.cgi}" />
1047
                <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1048
                <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1049

    
1050
                <!-- registry cgi section -->
1051
                <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1052
                        used in readDocumentFromMetacat -->
1053
                <!-- TODO MCD copy temp files to actual location using config util?? -->
1054
                <copy todir="${war.context.temp}" filtering="yes">
1055
                        <fileset dir="lib/style/common/emlb6toeml2">
1056
                                <include name="*.xsl" />
1057
                                <include name="*.xml" />
1058
                        </fileset>
1059
                </copy>
1060
                <available file="lib/style/common/emlb6toeml2" type="dir"
1061
                        property="styles.not.needed" />
1062

    
1063
                <!-- ldap cgi section -->
1064
                <copy todir="${war.context.templates}">
1065
                        <fileset dir="lib/style/common/templates">
1066
                                <!-- SCW: Copy all files -->
1067
                        </fileset>
1068
                </copy>
1069
        </target>
1070

    
1071
        <target name="cgiPrepare" if="build.perl">
1072
                <exec dir="src/perl/Metacat/" executable="make">
1073
                        <arg value="clean" />
1074
                </exec>
1075
                <exec dir="src/perl/Metacat/" executable="perl">
1076
                        <arg value="Makefile.PL" />
1077
                </exec>
1078
                <exec dir="src/perl/Metacat/" executable="make" />
1079
        </target>
1080

    
1081
        <target name="testPrepare"
1082
                description="Copies test files into the war directories">
1083
                <echo>in testPrepare</echo>
1084
                <property name="war.context.test"
1085
                        value="${build.war}/${metacat.context}/test" />
1086
                <mkdir dir="${war.context.test}" />
1087
                <copy todir="${war.context.test}" filtering="yes">
1088
                        <fileset dir="test/servertestfiles">
1089
                                <include name="*/**" />
1090
                        </fileset>
1091
                </copy>
1092
        </target>
1093

    
1094
        <target name="getConversionXSL" depends="prepare"
1095
                unless="styles.not.needed"
1096
                description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1097

    
1098
                <svn>
1099
                        <export srcUrl="${svn.eml2StyleUrl}"
1100
                                destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1101
                </svn>
1102

    
1103
                <mkdir dir="lib/style/common/emlb6toeml2" />
1104
                <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1105
                        <fileset
1106
                                dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1107
                                <include name="*.xsl" />
1108
                                <include name="*.xml" />
1109
                        </fileset>
1110
                </copy>
1111
        </target>
1112

    
1113
        <target name="testprep" depends="jar,clientjar,harvesterjar">
1114
                <mkdir dir="${build.tests}" />
1115
                <copy todir="${build.tests}" encoding="UTF-8">
1116
                        <fileset dir="${testdir}">
1117
                                <include name="edu/**" />
1118
                        </fileset>
1119
                </copy>
1120
                <copy todir="${build.tests}" file="${testdir}/test.properties" />
1121

    
1122
                <path id="test.classpath">
1123
                        <path refid="compile.classpath" />
1124
                        <fileset dir="${build.dir}">
1125
                                <include name="${name}.jar" />
1126
                                <include name="${name}-client.jar" />
1127
                                <include name="harvester.jar" />
1128
                        </fileset>
1129
                </path>
1130
                
1131
                <pathconvert pathsep="${line.separator}|  |--" 
1132
                             property="echo.test.classpath"
1133
                             refid="test.classpath">
1134
                </pathconvert>
1135
                <echo message="|--test classpath" />
1136
                <echo message="|  |" />
1137
                <echo message="|  |-- ${echo.test.classpath}" />
1138
                
1139
                <!-- copy and compile the tests into a jar file -->
1140
                <javac srcdir="${build.tests}" destdir="${build.tests}"
1141
                        debug="on" includes="**/*.java" encoding="UTF-8">
1142
                        <classpath refid="test.classpath" />
1143
                </javac>
1144

    
1145
                <jar jarfile="${build.dir}/${name}-junittests.jar"
1146
                        basedir="${build.tests}" >
1147
                        <include name="**/*.class"/>
1148
                        <include name="**/*.xml"/>
1149
                </jar>        
1150
                
1151
        </target>
1152

    
1153
        <target name="runoneclass" depends="testprep"
1154
                description="Uses the ant to run a class">
1155
                
1156
                <java classname="${classtorun}" fork="true">
1157
                        <arg line="${args}" />
1158
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1159
                        <classpath>
1160
                                <path refid="test.classpath" />
1161
                                <fileset dir="${build.dir}">
1162
                                        <include name="${name}.jar" />
1163
                                        <include name="${name}-client.jar" />
1164
                                        <include name="harvester.jar" />
1165
                                        <include name="${name}-junittests.jar" />
1166
                                </fileset>
1167
                        </classpath>
1168
                </java>
1169
        </target>
1170
        
1171
        <target name="test" depends="testprep"
1172
                description="Uses the ant junit task to run all JUnit tests">
1173

    
1174
                <!-- use the ant "junit" task to run JUnit tests. -->
1175
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1176
                        haltonerror="no">
1177
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1178
                        <classpath>
1179
                                <path refid="test.classpath" />
1180
                                <fileset dir="${build.dir}">
1181
                                        <include name="${name}.jar" />
1182
                                        <include name="${name}-client.jar" />
1183
                                        <include name="harvester.jar" />
1184
                                        <include name="${name}-junittests.jar" />
1185
                                </fileset>
1186
                        </classpath>
1187

    
1188
                        <formatter type="plain" />
1189

    
1190
                        <batchtest fork="yes" todir="${build.dir}">
1191
                                <fileset dir="${build.tests}">
1192
                                        <include name="**/*.class" />
1193
                                        <exclude name="**/MCTestCase.class" />
1194
                                        <exclude name="**/ClientViewHelperTest.class" />
1195
                                        <!-- these are not test cases -->
1196
                                        <exclude name="**/MockCNode.class" />
1197
                                        <exclude name="**/D1NodeServiceTest.class" />
1198
                                        <exclude name="**/D1NodeServiceTest$1.class" />
1199
                                        <exclude name="**/QueryRunner.class" />
1200
                                        <exclude name="**/MockObjectPathMap.class" />
1201
                                        <exclude name="**/HzObjectPathMapTest$1.class" />
1202
                                        <exclude name="**/HzObjectPathMapTest$2.class" />
1203
                                </fileset>
1204
                        </batchtest>
1205
                </junit>
1206
        </target>
1207

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

    
1211
                <echo>testtorun: ${testtorun}</echo>
1212

    
1213
                <!-- use the ant "junit" task to run JUnit tests. -->
1214
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1215
                        haltonerror="no" showoutput="yes">
1216
                        <jvmarg value="-Dfile.encoding=UTF-8"/>
1217
                        <classpath>
1218
                                <path refid="test.classpath" />
1219
                                <fileset dir="${build.dir}">
1220
                                        <include name="${name}.jar" />
1221
                                        <include name="${name}-client.jar" />
1222
                                        <include name="harvester.jar" />
1223
                                        <include name="${name}-junittests.jar" />
1224
                                </fileset>
1225
                        </classpath>
1226

    
1227
                        <formatter type="plain" />
1228

    
1229
                        <batchtest fork="yes" todir="${build.dir}">
1230
                                <fileset dir="${build.tests}">
1231
                                        <include name="**/${testtorun}.class" />
1232
                                </fileset>
1233
                        </batchtest>
1234
                </junit>
1235
        </target>
1236
        
1237
        <target name="run" depends="testprep"
1238
                        description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1239

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

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

    
1256
                                <formatter type="plain" />
1257

    
1258
                                <batchtest fork="yes" todir="${build.dir}">
1259
                                        <fileset dir="${build.tests}">
1260
                                                <include name="**/${testtorun}.class" />
1261
                                        </fileset>
1262
                                </batchtest>
1263
                        </junit>
1264
                </target>
1265

    
1266
        <target name="testharvester" depends="testprep"
1267
                description="Uses the ant junit task to test only the Harvester code">
1268
                <junit printsummary="yes" haltonfailure="off" fork="yes"
1269
                        haltonerror="off">
1270
                        <classpath>
1271
                                <path refid="compile.classpath" />
1272
                                <fileset dir="${build.dir}">
1273
                                        <include name="${name}.jar" />
1274
                                        <include name="${name}-client.jar" />
1275
                                        <include name="harvester.jar" />
1276
                                        <include name="${name}-junittests.jar" />
1277
                                </fileset>
1278
                        </classpath>
1279
                        <formatter type="plain" />
1280
                        <batchtest fork="yes" todir="${build.dir}">
1281
                                <fileset dir="${build.tests}">
1282
                                        <include name="**/harvesterClient/*.class" />
1283
                                </fileset>
1284
                        </batchtest>
1285
                </junit>
1286
        </target>
1287

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

    
1292
                <echo>
1293
                        *********************************** Please run ant
1294
                        gethttpclient first! ***********************************
1295
                </echo>
1296
                <!-- copy and compile the tests into a jar file -->
1297
                <mkdir dir="${build.metacatnettest}" />
1298
                <javac srcdir="${junitnettestsdir}"
1299
                        destdir="${build.metacatnettest}" includes="**/*.java">
1300
                        <classpath>
1301
                                <path refid="compile.classpath" />
1302
                                <fileset dir="${build.dir}">
1303
                                        <include name="${name}.jar" />
1304
                                </fileset>
1305
                        </classpath>
1306
                </javac>
1307

    
1308
                <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1309
                        basedir="${build.metacatnettest}" includes="**/*.class" />
1310

    
1311
                <!-- use the ant "junit" task to run JUnit tests. -->
1312
                <junit printsummary="yes" haltonfailure="no" fork="yes"
1313
                        haltonerror="no">
1314
                        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1315
                        <classpath>
1316
                                <path refid="compile.classpath" />
1317
                                <fileset dir="${build.dir}">
1318
                                        <include name="${name}.jar" />
1319
                                        <include name="${name}-junitnettests.jar" />
1320
                                </fileset>
1321
                        </classpath>
1322

    
1323
                        <formatter type="plain" />
1324

    
1325
                        <batchtest fork="yes" todir="${build.dir}">
1326
                                <fileset dir="${build.metacatnettest}">
1327
                                        <include name="**/*.class" />
1328
                                </fileset>
1329
                        </batchtest>
1330
                </junit>
1331
        </target>
1332

    
1333
        <target name="cleanweb" depends="clean"
1334
                description="deletes tomcat web context dir and all its contents">
1335
                <delete dir="${installdir}" />
1336
        </target>
1337

    
1338

    
1339
        <target name="clean" depends="init"
1340
                description="deletes build dir and files that can be regenerated form the release">
1341
                <delete dir="${build.dir}" />
1342
                <delete dir="${dist.dir}" />
1343
            <delete dir="${metacatui.build.dir}" />
1344
        </target>
1345

    
1346
        <target name="fullclean" depends="clean"
1347
                description="deletes code and eml">
1348
                <delete includeEmptyDirs="true" failonerror="false">
1349
                        <fileset dir="${style-common-cvsrelpath}">
1350
                                <include name="${eml-css}" />
1351
                                <include name="eml-*/*.xsl" />
1352
                                <include name="eml-*" />
1353
                        </fileset>
1354
                        <fileset dir="${schema-cvsrelpath}">
1355
                                <include name="eml-*/*.xsd" />
1356
                        </fileset>
1357
                        <fileset dir="${ecogrid-dir}"/>
1358
                        <fileset dir="lib/style/common/emlb6toeml2"/>
1359
                        <fileset dir="lib/dtd"/>
1360
                        <fileset dir="${libdir.mvn}"/>
1361
                </delete>
1362
                <!-- remove the entire directory -->
1363
                <delete includeemptydirs="true" dir="${metacatui.build.dir}" />
1364
                <!-- clean up the distribution files if they exist-->
1365
                <delete file="./${name}-bin-${release}.tar.gz" />
1366
                <delete file="./${name}-src-${release}.tar.gz" />
1367
                <delete file="./${name}-bin-${release}.zip" />
1368
                <delete file="./${name}-src-${release}.zip" />
1369
        </target>
1370
        
1371
        <target name="documentation" depends="javadoc,admindoc"
1372
            description="generates Javadoc API documentation and Admin Guide">
1373
    </target>
1374
        
1375
        <target name="admindoc" depends="prepare">
1376
                <!-- Build the administrator's guide, which is a Sphinx RST project
1377
                     For this to succeed, you must have Sphinx installed on your machine
1378
                     See: http://sphinx.pocoo.org/ for details
1379
                     And you must also have the 'make' build tool installed
1380
                -->
1381
                <exec dir="${docdir}/user/metacat" executable="make"> 
1382
                        <arg value="plantuml"/> 
1383
                </exec>
1384
                
1385
                <exec dir="${docdir}/user/metacat" executable="make"> 
1386
                        <arg value="html"/> 
1387
                </exec>
1388
                
1389
    </target>
1390

    
1391
        <target name="javadoc" depends="prepare"
1392
                description="generates Javadoc API documentation">
1393
                <javadoc packagenames="edu.ucsb.nceas.*"
1394
                        sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1395
                        version="true" use="true" windowtitle="${Name} API"
1396
                        doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1397
                        bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1398
                        <classpath>
1399
                                <path refid="compile.classpath" />
1400
                        </classpath>
1401
                </javadoc>
1402
        </target>
1403

    
1404
        <target name="dist"
1405
                depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL"
1406
                description="prepares a full release distribution">
1407
                <mkdir dir="${dist.dir}" />
1408
                <delete dir="${ver.dir}" />
1409
                <mkdir dir="${ver.dir}" />
1410
                <copy todir="${ver.dir}">
1411
                        <fileset dir="."
1412
                                excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1413
                </copy>
1414
                <copy todir="${ver.dir}" file="build.xml" />
1415
                <copy todir="${ver.dir}" file="build.properties" />
1416

    
1417
                <copy todir="${ver.dir}/docs" filtering="yes">
1418
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1419
                </copy>
1420
                <copy todir="${ver.dir}/docs" filtering="no">
1421
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1422
                </copy>
1423
                <copy todir="${ver.dir}/docs/dev">
1424
                        <fileset dir="${build.dir}/docs" />
1425
                </copy>
1426
                <copy todir="${ver.dir}/src">
1427
                        <fileset dir="${build.dir}/src" />
1428
                </copy>
1429

    
1430
                <mkdir dir="${ver.dir}/tests/servertestfiles" />
1431
                <copy todir="${ver.dir}/test/servertestfiles">
1432
                        <fileset dir="./test/servertestfiles" />
1433
                </copy>
1434
        </target>
1435

    
1436
        <target name="fulldist" depends="distbin, distsrc"
1437
                        description="full distribution - source and bin"/>
1438
                
1439
        <target name="distbin" depends="build-metacat,war-lsid"
1440
                description="prepares a binary distribution">
1441
                <copy todir="${dist.dir}">
1442
                        <fileset dir="./src/scripts" />
1443
                </copy>
1444
                <delete file="./${name}-bin-${release}.zip" />
1445
                <zip zipfile="./${name}-bin-${release}.zip"
1446
                        basedir="${dist.dir}" />
1447
                <delete file="./${name}-bin-${release}.tar.gz" />
1448
                <tar tarfile="./${name}-bin-${release}.tar"
1449
                        basedir="${dist.dir}" />
1450
                <gzip zipfile="./${name}-bin-${release}.tar.gz"
1451
                        src="./${name}-bin-${release}.tar" />
1452
                <delete file="./${name}-bin-${release}.tar" />
1453
        </target>
1454

    
1455
        <target name="distsrc" depends="dist"
1456
                description="prepares a source distribution">
1457
                <mkdir dir="${ver.src}" />
1458
                <copy todir="${ver.src}">
1459
                        <fileset dir="./src" />
1460
                </copy>
1461
                
1462

    
1463
                <mkdir dir="${ecogrid-dist-dir}" />
1464
                <copy todir="${ecogrid-dist-dir}">
1465
                        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1466
                </copy>
1467

    
1468

    
1469
                <delete file="./${name}-src-${release}.zip" />
1470
                <zip zipfile="./${name}-src-${release}.zip"
1471
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1472
                <delete file="./${name}-src-${release}.tar.gz" />
1473
                <tar tarfile="./${name}-src-${release}.tar"
1474
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1475
                <gzip zipfile="./${name}-src-${release}.tar.gz"
1476
                        src="./${name}-src-${release}.tar" />
1477
                <delete file="./${name}-src-${release}.tar" />
1478
                <!--delete dir="${dist.dir}"/ -->
1479
        </target>
1480

    
1481
        <target name="deb-package" depends="distbin"
1482
                description="create a debian installation package">
1483
                <delete dir="${deb.pkg.dir}" />
1484
                <mkdir dir="${deb.pkg.dir}/DEBIAN" />
1485
                <copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1486
                        <fileset dir="./src/scripts/debian"
1487
                                includes="control postinst" />
1488
                </copy>
1489

    
1490
                <mkdir
1491
                        dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1492
                <copy
1493
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1494
                        filtering="yes">
1495
                        <fileset dir="./src/scripts/debian"
1496
                                excludes="control postinst" />
1497
                </copy>
1498
                <chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1499

    
1500
                <copy file="${dist.dir}/${metacat.context}.war"
1501
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1502
                <copy file="./metacat-bin-${metacat.version}.tar.gz"
1503
                        tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1504

    
1505
                <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1506
                        failonerror="true">
1507
                        <arg line="--build debian" />
1508
                </exec>
1509

    
1510
                <move file="${pkg.dir}/debian.deb"
1511
                        tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1512
        </target>
1513

    
1514
        <target name="stylesheettest">
1515
                <xslt in="${input}" out="eml.html"
1516
                        style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1517
                        <param name="displaymodule" expression="${displaymodule}" />
1518
                        <param name="docid" expression="${input}" />
1519
                        <param name="entitytype" expression="${entitytype}" />
1520
                        <param name="entityindex" expression="${entityindex}" />
1521
                        <outputproperty name="method" value="html" />
1522
                        <outputproperty name="standalone" value="yes" />
1523
                        <outputproperty name="encoding" value="iso8859_1" />
1524
                        <outputproperty name="indent" value="yes" />
1525
                </xslt>
1526
        </target>
1527

    
1528
        <target name="spatial_option" depends="prepare"
1529
                description=" -- compiles code for the spatial option">
1530

    
1531
                <echo message="Compiling the metatcat shapefile creator" />
1532
                <echo message="using the shapelib at: ${shapelib.dir}" />
1533
                <exec dir="." executable="g++" os="Linux, Unix"
1534
                        failonerror="true">
1535
                        <arg
1536
                                line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1537
                </exec>
1538

    
1539
                <exec dir="." executable="g++" os="Linux, Unix"
1540
                        failonerror="true">
1541
                        <arg
1542
                                line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1543
                </exec>
1544
        </target>
1545

    
1546
        <!-- LSID Authority support -->
1547
        <patternset id="lsid.jars">
1548
                <include name="axis.jar" />
1549
                <include name="commons-discovery-0.2.jar" />
1550
                <include name="jaxrpc.jar" />
1551
                <include name="lsid-client-1.1.1.jar" />
1552
                <include name="lsid-server-1.1.1.jar" />
1553
                <include name="saaj.jar" />
1554
                <include name="wsdl4j-1.5.1.jar" />
1555
                <include name="activation.jar" />
1556
                <include name="castor-0.9.5.jar" />
1557
                <include name="dnsjava-1.3.2.jar" />
1558
                <include name="mail.jar" />
1559
                <include name="commons-logging-1.0.4.jar" />
1560
                <!-- These jars may be needed but seem to not actually be,
1561
                        so leaving them out for now
1562
                        <include name="axis-ant.jar" />
1563
                -->
1564
                <!--<include name="GenCastor.class" />-->
1565
        </patternset>
1566
        <patternset id="lib.jars">
1567
                <include name="log4j-1.2.12.jar" />
1568
                <include name="utilities-*.jar" />
1569
                <include name="xerces*.jar" />
1570
                <include name="xalan*.jar" />
1571
                <include name="xml-apis*.jar" />
1572
        </patternset>
1573

    
1574
        <path id="lsid.classpath">
1575
                <fileset dir="${lsid.lib.dir}">
1576
                        <patternset refid="lsid.jars" />
1577
                </fileset>
1578
                <fileset dir="${lib.dir}">
1579
                        <patternset refid="lib.jars" />
1580
                </fileset>
1581
                <fileset dir="${build.dir}">
1582
                        <include name="metacat-client.jar" />
1583
                        <include name="metacat.jar" />
1584
                </fileset>
1585
        </path>
1586

    
1587
        <filterset id="configFilters">
1588
                <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1589
                        value="${config.hostname}" / -->
1590
                <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1591
                        value="${config.port}" / -->
1592
                <!-- MCD BYE filter token="METADATA_LABELS"
1593
                        value="${config.metadataLabelLsid}" / -->
1594
                <!-- MCD BYE filter token="METACAT_SERVER"
1595
                        value="${config.metacatserver}" / -->
1596
                <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1597
                        value="${config.lsidauthority}" / -->
1598
        </filterset>
1599

    
1600
        <target name="prepare-lsid" depends="prepare,clientjar"
1601
                description="Configure files prior to compilation">
1602
                <mkdir dir="${lsid.build.dir}" />
1603
                <!-- Copy the properties file into the build -->
1604
                <copy file="${conf.dir}/metacat-lsid.properties"
1605
                        tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1606
                        overwrite="true">
1607
                        <filterset refid="configFilters" />
1608
                </copy>
1609
                <copy file="${conf.dir}/log4j.properties"
1610
                        tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1611
                        overwrite="true">
1612
                        <filterset refid="configFilters" />
1613
                </copy>
1614
                <!-- Copy config files into the build -->
1615
                <copy todir="${lsid.build.dir}/WEB-INF">
1616
                        <fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1617
                </copy>
1618
                <!-- Copy the metadata configuration files into the build -->
1619
                <mkdir
1620
                        dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1621
                <copy
1622
                        todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1623
                        <fileset dir="${conf.dir}" includes="**/*.xml" />
1624
                        <fileset dir="${conf.dir}" includes="**/*.xslt" />
1625
                        <filterset refid="configFilters" />
1626
                </copy>
1627
                <!-- Copy services files into the build -->
1628
                <mkdir dir="${lsid.build.dir}/services" />
1629
                <copy todir="${lsid.build.dir}/services">
1630
                        <fileset dir="${services.dir}" />
1631
                        <filterset refid="configFilters" />
1632
                </copy>
1633
                <!-- Copy axis files into the build -->
1634
                <mkdir dir="${lsid.build.dir}" />
1635
                <copy todir="${lsid.build.dir}">
1636
                        <fileset dir="${conf.dir}/axis" excludes="*.properties" />
1637
                </copy>
1638
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1639
                <copy todir="${lsid.build.dir}/WEB-INF/classes">
1640
                        <fileset dir="${conf.dir}/axis" includes="*.properties" />
1641
                </copy>
1642
        </target>
1643

    
1644
        <target name="compile-lsid" depends="prepare-lsid"
1645
                description="Compile Java sources">
1646
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1647
                <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1648
                        destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1649
                        deprecation="${compile.deprecation}"
1650
                        target="${java.target.version}"
1651
                        source="${java.source.version}"
1652
                        optimize="${compile.optimize}">
1653
                        <classpath>
1654
                                <path refid="compile.classpath" />
1655
                                <fileset dir="${build.dir}">
1656
                                        <include name="${name}.jar" />
1657
                                </fileset>
1658
                        </classpath>
1659
                </javac>
1660
        </target>
1661

    
1662
        <target name="war-lsid" depends="compile-lsid"
1663
                description="Create a war file for the application">
1664
                <mkdir dir="${dist.dir}" />
1665
                <war destfile="${dist.dir}/${authority.context}.war"
1666
                        webxml="${webinf.dir}/web.xml">
1667
                        <fileset dir="${lsid.build.dir}" />
1668
                        <lib dir="${lsid.lib.dir}">
1669
                                <patternset refid="lsid.jars" />
1670
                        </lib>
1671
                        <lib dir="${lib.dir}">
1672
                                <patternset refid="lib.jars" />
1673
                        </lib>
1674
                        <lib dir="${lib.dir}">
1675
                                <include name="xalan.jar" />
1676
                                <include name="xml-apis.jar" />
1677
                        </lib>
1678
                        <lib dir="${build.dir}">
1679
                                <include name="metacat-client.jar" />
1680
                        </lib>
1681
                </war>
1682
        </target>
1683

    
1684
        <target name="deploy-lsid" depends="war-lsid"
1685
                description="Deploy LSID war to servlet container">
1686
                <delete dir="${app.deploy.dir}/${authority.context}" />
1687
                <delete file="${app.deploy.dir}/${authority.context}.war" />
1688
                <mkdir dir="${app.deploy.dir}" />
1689
                <copy todir="${app.deploy.dir}">
1690
                        <fileset dir="${dist.dir}" />
1691
                </copy>
1692
        </target>
1693
        
1694
        <target name="change-metacat-properties" depends="warPrepare"
1695
        description="Chage some default values of metacat.properties">
1696
       <echo file="${metacat-properties-file}" append="true">
1697
                   configutil.propertiesConfigured=true
1698
                   configutil.authConfigured=true
1699
           configutil.skinsConfigured=true
1700
                   configutil.databaseConfigured=true
1701
                   configutil.geoserverConfigured=true
1702
           </echo>
1703
  </target>
1704
        
1705
        <!-- This target will use default values in svn metacat.properties to build a configured 
1706
                metacat (except configuti.* properties, they will be set true). Those default settings
1707
                are for a test machine. It may not work on your system-->
1708
        <target name="install-configured-metacat" depends="change-metacat-properties, install"
1709
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1710
    </target>
1711
        
1712
        <!-- build metacat-common jar -->
1713
        <target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1714
                <artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1715
                            <arg value="clean"/>
1716
                </artifact:mvn>
1717
                <artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1718
                   <arg value="install"/>
1719
                </artifact:mvn>
1720
                <property name="build-metacat-common-called" value="true"/>
1721
        </target>
1722

    
1723
        <!-- build metacat-index war -->
1724
        <target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >                
1725
                <artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1726
                        <arg value="clean"/>
1727
                </artifact:mvn>
1728
                <artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1729
                        <arg value="package"/>
1730
                        <!--<arg value="-Dmaven.test.skip=true"/>-->
1731
                </artifact:mvn>
1732
        </target>
1733
        
1734
        <target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >                
1735
                <copy tofile="${dist.dir}/metacat-index.war" >
1736
                        <fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1737
                </copy>        
1738
        </target>
1739
        
1740
        <target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >                
1741
                <copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1742
        </target>
1743
        
1744
        <!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1745
        <target name="war-identity" depends="warPrepare" description="Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password">
1746
                  <property name="war-name" value="identity" />
1747
                  <mkdir dir="${dist.dir}" />
1748
                     <war destfile="${dist.dir}/${war-name}.war"
1749
                            webxml="lib/account-web-info/web.xml">
1750
                      <webinf dir="${war.webinf}">
1751
                        <include name="metacat.properties"/>
1752
                        <include name="gd_intermediate_bundle_nceas_ldap.crt"/>
1753
                      </webinf>
1754
                      <fileset dir="${war.context}">
1755
                        <include name="cgi-bin/**"/>
1756
                              <include name="style/**"/>  
1757
                      </fileset>
1758
                      
1759
                   </war>
1760
        </target>
1761
        
1762
</project>